🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Georg Feil Wed, 15 Nov 1989 18:17
gas 1.34 has bug in floating-point number parsing
#541
Author: Georg Feil
Date: Wed, 15 Nov 1989 18:17
39 lines
1905 bytes
On the 68020 version of gas 1.34 (both 'sun3' and 'generic'), the 
binary-to-ascii floating-point number conversion routine loses precision
and produces an incorrect result in some cases. In particular, trailing zeroes
that should not affect the conversion cause loss of precision.

Test case: Assemble the following near-trivial file with 
     gas bad.s -o bad.o
and examine the binary output:

------------- bad.s --------------
.data
        .double 0r4.50359962737049600000e+15
----------------------------------


The hex representation of the above number should be
     4330 0000 0000 0000

but comes out as
     432f ffff fffe 0000

instead. The Sun assembler handles this correctly. However, if
we remove the trailing zeroes from the number, gas handles it correctly as
well. If we add more trailing zeroes, the gas result gets more inaccurate.
The number above comes from gcc 1.36 compiling the MAXPOWTWO preprocessor
macro defined in <values.h> on Suns. 

The problem lies somewhere in the source files atof-m68k.c or atof-generic.c,
but these are too cryptic for me to attempt a comprehensive bug search.
A quick fix would involve stripping trailing zeroes that follow a decimal
point before starting a conversion.

Georg
-- 
Georg Feil                                            "The roof is leaking
ghfeil@white.toronto.edu                               and the wind is howling"
...if that doesn't work try one of:
{uunet,pyramid,watmath,utzoo}!utcsri!white!ghfeil
ghfeil%white.toronto.edu@relay.cs.net     (ARPA)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads