chicken-hackers
[Top][All Lists]
Advanced

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

[Chicken-hackers] Single-precision doubles


From: Zbigniew
Subject: [Chicken-hackers] Single-precision doubles
Date: Sat, 7 Oct 2006 23:52:06 -0500

It's amazing, but it's true--on some embedded systems, doubles and
floats are both 32 bits.  In this case, the flonum size and tag
constants don't agree with the actual constructed flonum, because the
constants aren't based on sizeof(double).  The first patch
(runtime-basic-flonum.diff) fixes the issue and is probably safe to
apply, though not useful to a general audience.   Sorry it's not a
unified diff; it modifies C_flonum and C_number in runtime.c.

The second patch is more thorough but messier and probably should not
be applied except by those who need it.  It shrinks the size of
flonums from 4 to 2 words (we don't need to align the data) and
reduces the display precision to 7.  It requires that you #define
C_DOUBLE_IS_32_BITS to activate these changes; as written the patch
does that for you.  Basically, a quick hack because I'm just starting
to mess around with this system.

Of course, single-precision flonums mean you can't accurately
represent integers from 2^30 through 2^32-1 any more, but such is
life.

Attachment: runtime-basic-flonum.diff.txt
Description: Text document

Attachment: single-doubles.diff.txt
Description: Text document


reply via email to

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