chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] newbie question about numbers


From: Kon Lovett
Subject: Re: [Chicken-users] newbie question about numbers
Date: Wed, 17 Feb 2010 13:08:36 -0800

Hi, I tried your example, w/o & w/ the numbers egg.

#;1> (flonum-print-precision)
15
#;2> (/ 1 7)
0.142857142857143
#;3> (flonum-print-precision 23)
15
#;4> (/ 1 7)
0.14285714285714284921269
#;5> (flonum-print-precision 100)
23
#;6> (/ 1 7)
0.142857142857142849212692681248881854116916656494140625
#;7> (use numbers)
; loading /usr/local/chicken/5/lib/chicken/5/numbers.import.so ...
; loading /usr/local/chicken/5/lib/chicken/5/easyffi.import.so ...
; loading /usr/local/chicken/5/lib/chicken/5/numbers.so ...
#;8> (flonum-print-precision)
100
#;9> (exact->inexact (/ 1 7))
0.142857142857142849212692681248881854116916656494140625
#;10> (flonum-print-precision 15)
100
#;11> (exact->inexact (/ 1 7))
0.142857142857143

On Feb 17, 2010, at 9:50 AM, Hugo Arregui wrote:

Hi,

I have a few new questions about numbers:

Doing tests I find two values: flonum-precision (a variable) and

Well, a constant actually.

flonum-print-precision (a procedure), I suppose that the
flotnum-precision means the real working precision and the other one,
it's just for display. But, I tried:

Yes. 'flonum-print-precision' is the maximum number of significant digits. A discrepancy I know - one is in binary & the other in decimal digits.

Probably should rename 'flonum-print-precision' to 'flonum-significant- digits'.

FWIW, w/ MacOS X the '%.*g' conversion is used and 'gcvt' for all other platforms.


;I'm using numbers extension

(flonum-print-precision) => 15

flonum-precision => 53

(exact->inexact (/ 1 7)) => 0.142857142857143 ; It's what I expected

(flonum-print-precision 100) ; it's right?

(exact->inexact (/ 1 7)) => 0.14285714285714285 ; I expect 53 decimals
at least.. why this happens?

There's a way to change the flonum-precision?

Btw, there's a place to read this things and avoid disturbing you?.

Thanks again,
Hugo.


_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chicken-users

Best Wishes,
Kon






reply via email to

[Prev in Thread] Current Thread [Next in Thread]