/* Primitive operations on floating point for GNU Emacs Lisp interpreter.
-Copyright (C) 1988, 1993-1994, 1999, 2001-2011
+Copyright (C) 1988, 1993-1994, 1999, 2001-2012
Free Software Foundation, Inc.
Author: Wolfgang Rupprecht
#include "lisp.h"
#include "syssignal.h"
-#if STDC_HEADERS
#include <float.h>
-#endif
-
/* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */
#ifndef IEEE_FLOATING_POINT
#if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
extern double logb (double);
#endif /* not HPUX and HAVE_LOGB and no logb macro */
-#if defined(DOMAIN) && defined(SING) && defined(OVERFLOW)
+#if defined (DOMAIN) && defined (SING) && defined (OVERFLOW)
/* If those are defined, then this is probably a `matherr' machine. */
# ifndef HAVE_MATHERR
# define HAVE_MATHERR
#endif
#ifdef FLOAT_CATCH_SIGILL
-static SIGTYPE float_error ();
+static void float_error ();
#endif
/* Nonzero while executing in floating point.
Handle errors which may result in signals or may set errno.
Note that float_error may be declared to return void, so you can't
- just cast the zero after the colon to (SIGTYPE) to make the types
+ just cast the zero after the colon to (void) to make the types
check properly. */
#ifdef FLOAT_CHECK_ERRNO
return make_float (d);
}
-#if defined HAVE_ISNAN && defined HAVE_COPYSIGN
+#undef isnan
+#define isnan(x) ((x) != (x))
+
DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0,
doc: /* Return non nil iff argument X is a NaN. */)
(Lisp_Object x)
return isnan (XFLOAT_DATA (x)) ? Qt : Qnil;
}
-DEFUN ("copysign", Fcopysign, Scopysign, 1, 2, 0,
+#ifdef HAVE_COPYSIGN
+DEFUN ("copysign", Fcopysign, Scopysign, 2, 2, 0,
doc: /* Copy sign of X2 to value of X1, and return the result.
Cause an error if X1 or X2 is not a float. */)
(Lisp_Object x1, Lisp_Object x2)
if (y & 1)
acc *= x;
x *= x;
- y = (unsigned)y >> 1;
+ y >>= 1;
}
}
XSETINT (val, acc);
if (f1 == 0.0 && f2 == 0.0)
f1 = 1.0;
#ifdef FLOAT_CHECK_DOMAIN
- else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor(f2)))
+ else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor (f2)))
domain_error2 ("expt", arg1, arg2);
#endif
IN_FLOAT2 (f3 = pow (f1, f2), "expt", arg1, arg2);
}
\f
#ifdef FLOAT_CATCH_SIGILL
-static SIGTYPE
-float_error (signo)
- int signo;
+static void
+float_error (int signo)
{
if (! in_float)
fatal_error_signal (signo);
defsubr (&Scos);
defsubr (&Ssin);
defsubr (&Stan);
-#if defined HAVE_ISNAN && defined HAVE_COPYSIGN
defsubr (&Sisnan);
+#ifdef HAVE_COPYSIGN
defsubr (&Scopysign);
defsubr (&Sfrexp);
defsubr (&Sldexp);