Thread

  1. Trouble with exp() on S/Linux?

    Keith Parks <emkxp01@mtcc.demon.co.uk> — 1998-01-09T15:53:57Z

    Hi,
    
    I have built and installed the latest version of the PostgreSQL RDBMS
    on S/Linux but am having problems with the regression tests.
    
    Many of the failures come from floating point exceptions.
    
    I've written a small c prog to demonstrate the problem which seems to
    show that using exp() on a number less than 1.0e-150 gives an FPE.
    
    Can anyone tell me what's broken, if anything.
    
    I'm really not sure whether it is...
    
    cpu    : Fujitsu or Weitek Power-UP
    fpu    : Fujitsu or Weitek on-chip FPU               
    kernel : sparclinux-2.0-980106
    libc/m : libc.so.5.3.12/libm.so.5.0.6
    gcc    : gcc version 2.7.2.1
    
    Something else???
    Expected behaviour???
    
    The machine is a SPARCstation IPX running Red Hat 4.2.
    
    Thanks for any help,
    Keith.
    
    [emkxp01@sparclinux ~]$ cat mxdb.c
    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>
    #include <float.h>
    
    main()
    {
            double dbval;
    
            dbval = atof("1.0e-150");
            printf("dbl1 = %e\n", dbval);
            printf("Exp dbl1 = %e\n", exp(dbval));
            dbval = atof("1.0e-151");
            printf("dbl2 = %e\n", dbval);
            printf("Exp dbl2 = %e\n", exp(dbval));
    }                                            
    [emkxp01@sparclinux ~]$ gcc mxdb.c -lm
    [emkxp01@sparclinux ~]$ ./a.out
    dbl1 = 1.000000e-150
    Exp dbl1 = 1.000000e+00
    dbl2 = 1.000000e-151
    Floating exception (core dumped)