This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Bug with g77 and -mieee on Alpha Linux
Sorry, I forgot to cc: the list.
craig@jcb-sc.com wrote:
>
> Second, the issue is not what *usually* happens in IEEE.
>
> The issue is, what happens when the program computes the wrong values,
> due to bugs, ill-conditioned inputs, etc.
I agree with you, and it's nice to hear a regular contributor to this
list espouse robustness in a compiler's default product. For instance,
optimizations that may produce dangerous code come with adequate
warnings and are never the default.
I just want to point out a very normal calculation that has nothing to
do with bugs or ill-conditioned input. The library function exp(), when
you are using the libm that comes with most systems, can easily produce
a denormal. If you want exp() to force denormals to 0, I think you need
to use a different library.
It makes sense to me that the compiler should generate code compatible
with the standard version of libm. It should be an option, not a
default, that you want faster code and that you will link to a
nonstandard (perhaps faster, too) math library like libffm.
I also received this suggestion from Mark Davis at Digipaq (I don't
recall whether it was before or after the merger). You might consider
putting it into an application's start-up code when no -mieee option is
given, or at least you could you add it to your docs about handling
floating-point problems on alphas:
See "man ieee", and #include <machine/fpu.h>. When the program starts
up, make a call to ieee_set_fp_control(IEEE_MAP_UMZ); , which sets the
fp control to cause underflow to map to zero.
[Note, fpu.h has the line:
#define IEEE_MAP_UMZ 0x002000 /* infinities map to largest
num */
but the comment is WRONG - UMZ means Underflow Maps to Zero!]
--
Dick Hadsell 914-381-8400 x5446 Fax: 914-381-9790
Reply-to: hadsell@blueskystudios.com
Blue Sky Studios http://www.blueskystudios.com
1 South Road, Harrison, NY 10528