[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] printing floats
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] printing floats |
Date: |
Tue, 18 Jan 2005 13:04:17 +0100 |
On Tue, 18 Jan 2005 10:21:57 +0100 (CET),
address@hidden <address@hidden>
wrote:
>
> Chicken prints floats like this:
> #;1> (write (* 999 999 999.))
> 997002999.
> #;2> (write (* 999 999 999.0))
> 997002999.
>
> Some other Scheme implementations always add a 0:
>
> #;1> (write (* 999 999 999.))
> 997002999.0
> #;2> (write (* 999 999 999.0))
> 997002999.0
>
> I think both implementations are correct.
> If so, how can I force chicken to add the 0?
>
cd /home/fwinkel/stuff/chicken/
diff -c /home/fwinkel/stuff/chicken/runtime.c\~
/home/fwinkel/stuff/chicken/runtime.c
*** /home/fwinkel/stuff/chicken/runtime.c~ 2005-01-17 05:29:31.000000000
+0100
--- /home/fwinkel/stuff/chicken/runtime.c 2005-01-18 13:02:00.737394736
+0100
***************
*** 6713,6719 ****
#endif
if((p = strpbrk(buffer, C_text(".eE"))) == NULL)
! strcat(buffer, C_text("."));
p = buffer;
goto fini;
--- 6713,6719 ----
#endif
if((p = strpbrk(buffer, C_text(".eE"))) == NULL)
! strcat(buffer, C_text(".0"));
p = buffer;
goto fini;
(I think putting a trailing '0' is nicer, so I'll make this change
permanent).
cheers,
felix