The code needed for isnan() needs to construct a NaN or Inf object. But doing so leads to a SIGFPE by default on Alpha systems. There's only one way to get IEEE compliant behaviour of elementary arithmetic operations on this platform: instruct the compiler to emit different (more expensive) floating-point instructions. This module implements it.
2007-03-25 Bruno Haible <[EMAIL PROTECTED]> * modules/fpieee: New file. * m4/fpieee.m4: New file. * modules/isnan-nolibm (Depends-on): Add fpieee. * modules/isnanl-nolibm (Depends-on): Add fpieee. * modules/isnanl (Depends-on): Add fpieee. =============================== modules/fpieee ================================ Description: Ensure IEEE compliant floating-point operations (overflow and division by zero). Files: m4/fpieee.m4 Depends-on: configure.ac-early: AC_REQUIRE([gl_FP_IEEE]) configure.ac: Makefile.am: Include: License: LGPL Maintainer: Bruno Haible ================================ m4/fpieee.m4 ================================= # fpieee.m4 serial 1 dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl IEEE 754 standardized three items: dnl - The formats of single-float and double-float - nowadays commonly dnl available as 'float' and 'double' in C and C++. dnl No autoconf test needed. dnl - The overflow and division by zero behaviour: The result are values dnl '±Inf' and 'NaN', rather than exceptions as it was before. dnl This file provides an autoconf macro for ensuring this behaviour of dnl floating-point operations. dnl - A set of conditions (overflow, underflow, inexact, etc.) which can dnl be configured to trigger an exception. dnl This cannot be done in a portable way: it depends on the compiler, dnl libc, kernel, and CPU. No autoconf macro is provided for this. dnl Ensure non-trapping behaviour of floating-point overflow and dnl floating-point division by zero. dnl (For integer overflow, see gcc's -ftrapv option; for integer division by dnl zero, see the autoconf macro in intdiv0.m4.) AC_DEFUN([gl_FP_IEEE], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) # IEEE behaviour is the default on all CPUs except Alpha # (according to the test results of Bruno Haible's ieeefp/fenv_default.m4). case "$host_cpu" in alpha*) # On Alpha systems, a compiler option provides the behaviour. # See the ieee(3) manual page, also available at # <http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/0600____.HTM> if test -n "$GCC"; then # GCC has the option -mieee. CPPFLAGS="$CPPFLAGS -mieee" else # Compaq (ex-DEC) C has the option -ieee. CPPFLAGS="$CPPFLAGS -mieee" fi ;; esac ]) =============================================================================== *** modules/isnan-nolibm 25 Mar 2007 01:06:39 -0000 1.2 --- modules/isnan-nolibm 25 Mar 2007 23:48:24 -0000 *************** *** 8,13 **** --- 8,14 ---- m4/isnan.m4 Depends-on: + fpieee configure.ac: gl_FUNC_ISNAN_NO_LIBM *** modules/isnanl-nolibm 25 Mar 2007 01:06:39 -0000 1.4 --- modules/isnanl-nolibm 25 Mar 2007 23:48:24 -0000 *************** *** 10,15 **** --- 10,16 ---- m4/longdouble.m4 Depends-on: + fpieee configure.ac: gl_FUNC_ISNANL_NO_LIBM *** modules/isnanl 25 Mar 2007 01:06:39 -0000 1.2 --- modules/isnanl 25 Mar 2007 23:48:24 -0000 *************** *** 10,15 **** --- 10,16 ---- m4/longdouble.m4 Depends-on: + fpieee configure.ac: gl_FUNC_ISNANL