[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-smalltalk] [PATCH] fix FloatQ reading
From: |
Paolo Bonzini |
Subject: |
[Help-smalltalk] [PATCH] fix FloatQ reading |
Date: |
Sat, 11 Jul 2009 13:03:27 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2 |
Hi all and especially Nicolas,
here is my shotgun approach to fixing the reading of FloatQ. The
problem lies in Smalltalk's support for arbitrary bases, which does not
allow me to use the optimized strtod function from the C library.
I decided to write my own tiny floating-point math library (I couldn't
decide whether using mpf/mpfr was *more* or *less* shotgun) so that I
can read the FP numbers in 160 bit precision. This is somewhat dual to
what the Smalltalk code does, which uses fractions and multi-precision
integers, and it is also how GCC works by the way (though they have more
stuff to do because of handling denormals, NaNs and infinities).
While I tried it a bit, there might be bugs, so I ask you all to figure
out some stress tests. These are needed because at some point all
floats were returned multiplied by 2 :-) and "make" still built... I
tried on the ones from http://smalltalk.gnu.org/project/issue/313, as
well as a few others like 1q3000/1q2999 or 3.6451995318824746025q-4951
(FloatQ fmin), and they seem to work. Ideas on how to incorporate these
into floatmath.st as portably as possible are also welcome.
The code is already in git.
Paolo
gst-real-reading.patch
Description: Text document
- [Help-smalltalk] [PATCH] fix FloatQ reading,
Paolo Bonzini <=