author | Aleksandar Samardžić <asamardzic@matf.bg.ac.rs> | 2012年09月22日 14:11:43 +0200 |
---|---|---|
committer | Aleksandar Samardžić <asamardzic@matf.bg.ac.rs> | 2012年09月22日 14:11:43 +0200 |
commit | 5028e622b62303401c74d9aa0976e19ed2f6eb34 (patch) | |
tree | a21d55edc6cee332b54785f877229fa7a0cbb3ff | |
parent | 02df692a94039d69fe0292ab05f5f596304333e5 (diff) | |
download | libmatheval-5028e622b62303401c74d9aa0976e19ed2f6eb34.tar.gz |
-rw-r--r-- | INSTALL | 9 | ||||
-rw-r--r-- | lib/xmath.c | 6 | ||||
-rw-r--r-- | lib/xmath.h | 6 |
@@ -1,8 +1,8 @@ Installation Instructions ************************* -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006, 2007, 2008, 2009 Free Software Foundation, Inc. +Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, +Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright @@ -226,6 +226,11 @@ order to use an ANSI C compiler: and if that doesn't work, install pre-built binaries of GCC for HP-UX. + HP-UX `make' updates targets which have the same time stamps as +their prerequisites, which makes it generally unusable when shipped +generated files such as `configure' are involved. Use GNU `make' +instead. + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `<wchar.h>' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended diff --git a/lib/xmath.c b/lib/xmath.c index 1310b2f..1bd5f81 100644 --- a/lib/xmath.c +++ b/lib/xmath.c @@ -162,7 +162,7 @@ math_step(double x) /* * Calculate step function value. */ - return (x < 0) ? 0 : 1; + return MATH_ISNAN(x) ? x : ((x < 0) ? 0 : 1); } double @@ -171,7 +171,7 @@ math_delta(double x) /* * Calculate delta function value. */ - return (x == 0) ? MATH_INFINITY : 0; + return MATH_ISNAN(x) ? x : ((x == 0) ? MATH_INFINITY : 0); } double @@ -180,5 +180,5 @@ math_nandelta(double x) /* * Calculate modified delta function value. */ - return (x == 0) ? MATH_NAN : 0; + return MATH_ISNAN(x) ? x : ((x == 0) ? MATH_NAN : 0); } diff --git a/lib/xmath.h b/lib/xmath.h index 921e442..4a54db1 100644 --- a/lib/xmath.h +++ b/lib/xmath.h @@ -48,6 +48,12 @@ #define MATH_NAN (0.0/0.0) #endif +#ifdef isnan +#define MATH_ISNAN(x) isnan(x) +#else +#define MATH_ISNAN(x) ((x) != (x)) +#endif + /* Calculate cotangent of value x. */ double math_cot(double x); |