chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Prevent Chicken from truncating large flon


From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] Prevent Chicken from truncating large flonums when compiling
Date: Sat, 17 Sep 2011 18:15:29 +0200
User-agent: Mutt/1.4.2.3i

On Sat, Sep 17, 2011 at 05:56:52PM +0200, Peter Bex wrote:
> Hi all,
> 
> This is a patch and bugreport rolled into one ;)
> 
> While testing the "numbers" egg I found out that programs
> containing flonum literals can behave differently when compiled
> or interpreted.

I forgot, but here's a simple test you can use to more easily see
this in action:

----------
;; Use -O0 to compile, else the comparison gets completely optimized away ;)
(print "equal when read? " (= 1237940039285380274899124224 
1237940039285380274899124224))
(print "equal when read and converted? " (= 1237940039285380274899124224 
(string->number "1237940039285380274899124224")))
----------

This code can also be run through the interpreter and you can see
it works fine there (prints "#t" for both cases).

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth



reply via email to

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