[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#210598: libc6.1: Operations on subnormal floating-point numbers generate a floating point exception



On Sat, Sep 13, 2003 at 01:00:23AM +0200, Vincent Lefevre wrote:
> On 2003-09-12 18:35:21 -0400, Daniel Jacobowitz wrote:
> > I.E. without -mieee denormalized numbers are not completely
> > supported.
> 
> If they are not completely supported, the libc shouldn't generate
> them (to avoid FPE signals when results of libc functions are used
> in input of other operations).

This is not a glibc problem.  It's not the call to fprintf which is
faulting.  It's the addition of 1.0 to a denormal.  Try it:

#include <stdio.h>
#include <math.h>
double global;
int main (void)
{ 
  double x = ldexp (1.0, -1038);
  fprintf (stderr, "%g\n", x);
  global = x + 1.0; //fprintf (stderr, "%g\n", x + 1.0);
  return 0;
}

> > There's no way to fix this without using -mieee, and for some reason
> > I can't remember at the moment the GCC maintainers do not want that
> > to be the default. If you care about compliance of FP code, use
> > -mieee.
> 
> I completely disagree. I care about the C standard, and I explicitely
> say so with the -std=c99 option. Perhaps things like -std=c99 should
> imply -mieee then, if no change is done in glibc (and __STDC__
> shouldn't be defined if no such option is used).

Raise that with the Alpha compiler maintainer, Richard Henderson.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



Reply to: