[Coco] Nitros9 C compiler. Printf can't print float or double values.

Walter Zambotti zambotti at iinet.net.au
Sat May 18 08:04:12 EDT 2019


Possibly why Microware chose to make floating point printing optional. Does seem a bit big though. 

Anyway I can print the valuez the rand function in the clib returns signed integer values between 0 and 32767.

I need a rand function thay returns a double between 0 and 1 and dividing 1 by rand wont give enough variation. 

Does anyone know what functions are in mlib.l and randomlib.l?

Walter 


Sent from my Xperia by Sony smartphone

---- Bill Pierce via Coco wrote ----

>Walter, I think both pffinit and pflinint are memory hogs, so you only want to include them when needed (not sure). The way I see it, anything I can leave out is a bonus when trying to work in 64k of memory. :-)
> 
> 
> 
>-----Original Message-----
>From: Walter Zambotti <zambotti at iinet.net.au>
>To: Bill Pierce via Coco <coco at maltedmedia.com>
>Sent: Thu, May 16, 2019 11:48 pm
>Subject: Re: [Coco] Nitros9 C compiler. Printf can't print float or double values.
>
>Ta Bill
>
>Should put that in C start! 
>
>Walter 
>
>
>Sent from my Xperia by Sony smartphone
>
>---- Bill Pierce via Coco wrote ----
>
>>To print doubles and floats in C, you must declare "pffinit()" somewhere early in your program. It's in the description of the "printf()" statement in the MicroWare C Compilers Guide (and the K&R book).
>> 
>> 
>> 
>>-----Original Message-----
>>From: Walter Zambotti <zambotti at iinet.net.au>
>>To: 'CoCoList for Color Computer Enthusiasts' <coco at maltedmedia.com>
>>Sent: Thu, May 16, 2019 3:34 am
>>Subject: [Coco] Nitros9 C compiler. Printf can't print float or double values.
>>
>>That's about it
>>
>> 
>>
>>double myval = 0;
>>
>>printf("val = %f %e %g\n", myval, myval, myval);
>>
>> 
>>
>>Just prints:
>>
>>val =
>>
>> 
>>
>>What gives?
>>
>> 
>>
>>Walter
>>
>>
>>-- 
>>Coco mailing list
>>Coco at maltedmedia.com
>>https://pairlist5.pair.net/mailman/listinfo/coco
>>
>>-- 
>>Coco mailing list
>>Coco at maltedmedia.com
>>https://pairlist5.pair.net/mailman/listinfo/coco
>
>-- 
>Coco mailing list
>Coco at maltedmedia.com
>https://pairlist5.pair.net/mailman/listinfo/coco
>
>-- 
>Coco mailing list
>Coco at maltedmedia.com
>https://pairlist5.pair.net/mailman/listinfo/coco


More information about the Coco mailing list