Subject: lib/153: hypot(3) gives incorrect results when compiled with -O
To: Matthieu Herrb <matthieu@laas.fr>
From: J.T. Conklin <conklin@ngai.kaleida.com>
List: netbsd-bugs
Date: 03/03/1994 15:55:47
Matthieu> the __ieee754_hypot function returns the wrong answer
Matthieu> in almost every case when compiled with -O.
This is a duplicate bug. Oh well, I guess that's one of the dangers
of having the quality of users that we have.
I committed a fix to the math library this morning that replaced
fdlibm's run-time byte order detection with appropriate constants.
This fixes hypot(). It also fixes asin(), which some of you may
remember was the only function that had failures when I preformed my
libm vs. fdlibm tests on a i386 without a i387. This change could
also be fixing other problems that we didn't know about yet.
I was able determine what was causing the problem by studying gcc's
assembly output for both optimized & unoptimized cases. I created a
simple test case, and submitted an article to the language-lawyer
types in comp.std.c asking if they think Gcc's optimization was too
aggressive, or the bug is in fdlibm.
--jtc
------------------------------------------------------------------------------