Trouble with exp() on S/Linux?
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)
Tom,
Thanks for your testing and feedback.
I got the attached reply from Jakub Jelinek on the "sparclinux" list which
explains the problem.
I guess that your sparc20 does not need help from the kernel with this math.
If you get chance to try a snapshot I'd be interested in your experiences.
Thanks,
Keith.
BTW: I used the linux-elf template with a few minor changes.
*** linux-elf Sat Oct 25 09:49:56 1997
--- sparc-linux-elf Thu Jan 8 16:56:44 1998
***************
*** 1,9 ****
AROPT:crs
! CFLAGS:-O2 -m486
! SHARED_LIB:-fpic
ALL:
SRCH_INC:/usr/include/ncurses /usr/include/readline
! SRCH_LIB:
USE_LOCALE:no
DLSUFFIX:.so
YFLAGS:-d
--- 1,9 ----
AROPT:crs
! CFLAGS:-O2
! SHARED_LIB:-fPIC
ALL:
SRCH_INC:/usr/include/ncurses /usr/include/readline
! SRCH_LIB:/usr/local/lib
USE_LOCALE:no
DLSUFFIX:.so
YFLAGS:-d
------------- Begin Forwarded Message -------------
From: Jakub Jelinek <jj@sunsite.ms.mff.cuni.cz>
Subject: Re: Trouble with exp() on S/Linux?
To: emkxp01@mtcc.demon.co.uk
Date: Fri, 9 Jan 1998 17:32:16 +0100 (MET)
Mime-Version: 1.0
X-Orcpt: rfc822;sparclinux@vger.rutgers.edu
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.
Kernel is broken.
Expected behaviour???
No, just need to be fixed. On some FPUs hw expect subnormal calculations to
be emulated in software and kernel is not doing that. We have support for
this for sparc64, it just needs to be backported.
Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
Ultralinux - first 64bit OS to take full power of the UltraSparc
Linux version 2.0.32 on a sparc machine (291.64 BogoMips).
___________________________________________________________________
------------- End Forwarded Message -------------
Import Notes
Resolved by subject fallback