Mail Archives: djgpp-workers/2003/08/13/14:13:44
Esa A E Peuha wrote:
>I agree. This should definitely divide by ten to produce as accurate
>result as possible. Multiplying by 0.1 will cause errors when the
>number has large absolute value. Could someone test the following patch
>before I commit it?
>- tmp = modfl(integer * 0.1L , &integer);
>+ tmp = modfl(integer / 10.0L , &integer);
> *p-- = tochar((int)((tmp + .01L) * 10));
>
I haven't had the time to examine this in detail, but the addition of
0.01L is also not exact, so the patch, though it fixes one source of
error, may not be sufficient. By the way, Stephen Moshier wrote some
code for a long double printf that he claims "passes tests for
compliance with IEEE 754 and 854 standards". I haven't examined it,
either, but I have a high opinion of his work in general, so the code
may be useful, whether it is used as-is, or if the techniques are
adapted to the purpose at hand:
http://www.moshier.net/smldbl12.zip
-Eric Rudd
rudd AT cyberoptics DOT com
- Raw text -