Subject: Floating-point errors
To: None <cusa!hellgate!!>
From: neb!bbs!trevin.beattie <cusa!Trevin.Beattie>
List: netbsd-bugs
Date: 01/01/1994 09:58:09
While compiling X11R5, I ran across a problem in the executable
file "to_wfont": it kept aborting with exception #8: floating
point error.  Not finding any obvious problem with the source
code, I ran the program through gdb and discovered that the
exception occurred during the system library call "atof", with
perfectly innocent arguments (in multiple runs, the program
aborted at different times).
So the next thing I did was write my own small test program
(which incidentally turned up another major problem, which I
will explain along with the source code in comp.unix.questions).
I discovered that -usually- when I entered a whole number it
would translate through atof correctly, but if I entered any
number with a decimal point in it, atof would return the wrong
answer.  Regardless of the numbers I entered, after some random
number of loops the test program aborted with a floating point
exception.  I repeated the tests using several different
compilation options: -O or -g, w/ or w/o -msoft-float,
recompiling atof.c and strtod.c with those options,....
I am running NetBSD 0.9 with a recompiled kernel comfigured for
my hardware (+Logitech bus, -ethernet, -scsi, +swap on wd1)
on an AT-compatible '386 (cyrrix, I think) with a '387
coprocessor, 10MB RAM, 30MB swap, nothing installed other than
NetBSD (everything) and the mit source tree of X11R5.
                    -- Trevin Beattie
Mail: bbs!trevin.beattie@neb