|
From: | Kon Lovett |
Subject: | Re: [Chicken-users] read / write floats |
Date: | Sat, 25 Aug 2007 15:14:27 -0700 |
On Aug 25, 2007, at 1:44 PM, Gábor Balázs wrote: Hello, This is real "gotcha" in core Chicken. See the " numbers" egg. $ csi this is CHICKEN Version 2.637 - macosx-unix-gnu-ppc - [ manyargs dload ptables extraslot applyhook autotools ] (c)2000-2007 Felix L. Winkelmann ; loading /Users/klovett/.csirc ... #;1> (use numbers) ; loading /usr/local/lib/chicken/1x/numbers.scm ... ; loading /usr/local/lib/chicken/1x/numbers-base.so ... #;2> (define v1 (/ 1 3)) (call-with-output-file "try.dat" (lambda (port) (write v1 port))) (define v2 (call-with-input-file "try.dat" (lambda (port) (read port)))) (print "v1 = " v1) (print "v2 = " v2) (print (equal? v1 v2)) (print (= v1 v2)) (print (- v1 v2)) #;3> #;4> #;5> v1 = 1/3 "v1 = " #;6> v2 = 1/3 "v2 = " #;7> #t #t #;8> #t #t #;9> However , this only works because the 'v' values are exact! '(define v1 (exact->inexact (/ 1 3)))' still has the read/write invariance problem. I tried to report this, but I did not find the easy way.
|
[Prev in Thread] | Current Thread | [Next in Thread] |