Mercurial > hg > octave-kai > gnulib-hg
diff lib/math.in.h @ 9898:02bfc9acab82
Work around Solaris 10 math.h bug.
* m4/math_h.m4 (gl_MATH_H): Check for bug.
(gl_MATH_H_DEFAULTS): Set up default.
* modules/math (Makefile.am): Replace new indicators.
* lib/math.in.h (NAN, HUGE_VAL): Provide replacements.
* tests/test-math.c (main): Test this.
* m4/strtod.m4 (gl_FUNC_STRTOD): Don't rely on HUGE_VAL.
* doc/posix-headers/math.texi (math.h): Mention bug.
Reported by Nelson H. F. Beebe and Jim Meyering.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Sat, 12 Apr 2008 07:22:40 -0600 (2008-04-12) |
parents | 7f3ed6b093be |
children | d3f5a70dc1ba |
line wrap: on
line diff
--- a/lib/math.in.h +++ b/lib/math.in.h @@ -1,6 +1,6 @@ /* A GNU-like <math.h>. - Copyright (C) 2002-2003, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2007-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,8 +34,11 @@ /* POSIX allows platforms that don't support NAN. But all major machines in the past 15 years have supported something close to - IEEE NaN, so we define this unconditionally. */ -#ifndef NAN + IEEE NaN, so we define this unconditionally. We also must define + it on platforms like Solaris 10, where NAN is present but defined + as a function pointer rather than a floating point constant. */ +#if !defined NAN || @REPLACE_NAN@ +# undef NAN /* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ # ifdef __DECC static float @@ -50,6 +53,13 @@ # endif #endif +/* Solaris 10 defines HUGE_VAL, but as a function pointer rather + than a floating point constant. */ +#if @REPLACE_HUGE_VAL@ +# undef HUGE_VAL +# define HUGE_VAL (1.0 / 0.0) +#endif + /* Write x as x = mantissa * 2^exp where