diff options
Diffstat (limited to 'src/floatfns.c')
| -rw-r--r-- | src/floatfns.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/floatfns.c b/src/floatfns.c index b5c8b4af5c3..305c78cae63 100644 --- a/src/floatfns.c +++ b/src/floatfns.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Primitive operations on floating point for GNU Emacs Lisp interpreter. | 1 | /* Primitive operations on floating point for GNU Emacs Lisp interpreter. |
| 2 | 2 | ||
| 3 | Copyright (C) 1988, 1993-1994, 1999, 2001-2011 | 3 | Copyright (C) 1988, 1993-1994, 1999, 2001-2012 |
| 4 | Free Software Foundation, Inc. | 4 | Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | Author: Wolfgang Rupprecht | 6 | Author: Wolfgang Rupprecht |
| @@ -53,10 +53,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 53 | #include "lisp.h" | 53 | #include "lisp.h" |
| 54 | #include "syssignal.h" | 54 | #include "syssignal.h" |
| 55 | 55 | ||
| 56 | #if STDC_HEADERS | ||
| 57 | #include <float.h> | 56 | #include <float.h> |
| 58 | #endif | ||
| 59 | |||
| 60 | /* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */ | 57 | /* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */ |
| 61 | #ifndef IEEE_FLOATING_POINT | 58 | #ifndef IEEE_FLOATING_POINT |
| 62 | #if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ | 59 | #if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ |
| @@ -74,7 +71,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 74 | extern double logb (double); | 71 | extern double logb (double); |
| 75 | #endif /* not HPUX and HAVE_LOGB and no logb macro */ | 72 | #endif /* not HPUX and HAVE_LOGB and no logb macro */ |
| 76 | 73 | ||
| 77 | #if defined(DOMAIN) && defined(SING) && defined(OVERFLOW) | 74 | #if defined (DOMAIN) && defined (SING) && defined (OVERFLOW) |
| 78 | /* If those are defined, then this is probably a `matherr' machine. */ | 75 | /* If those are defined, then this is probably a `matherr' machine. */ |
| 79 | # ifndef HAVE_MATHERR | 76 | # ifndef HAVE_MATHERR |
| 80 | # define HAVE_MATHERR | 77 | # define HAVE_MATHERR |
| @@ -285,7 +282,9 @@ DEFUN ("tan", Ftan, Stan, 1, 1, 0, | |||
| 285 | return make_float (d); | 282 | return make_float (d); |
| 286 | } | 283 | } |
| 287 | 284 | ||
| 288 | #if defined HAVE_ISNAN && defined HAVE_COPYSIGN | 285 | #undef isnan |
| 286 | #define isnan(x) ((x) != (x)) | ||
| 287 | |||
| 289 | DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0, | 288 | DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0, |
| 290 | doc: /* Return non nil iff argument X is a NaN. */) | 289 | doc: /* Return non nil iff argument X is a NaN. */) |
| 291 | (Lisp_Object x) | 290 | (Lisp_Object x) |
| @@ -294,7 +293,8 @@ DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0, | |||
| 294 | return isnan (XFLOAT_DATA (x)) ? Qt : Qnil; | 293 | return isnan (XFLOAT_DATA (x)) ? Qt : Qnil; |
| 295 | } | 294 | } |
| 296 | 295 | ||
| 297 | DEFUN ("copysign", Fcopysign, Scopysign, 1, 2, 0, | 296 | #ifdef HAVE_COPYSIGN |
| 297 | DEFUN ("copysign", Fcopysign, Scopysign, 2, 2, 0, | ||
| 298 | doc: /* Copy sign of X2 to value of X1, and return the result. | 298 | doc: /* Copy sign of X2 to value of X1, and return the result. |
| 299 | Cause an error if X1 or X2 is not a float. */) | 299 | Cause an error if X1 or X2 is not a float. */) |
| 300 | (Lisp_Object x1, Lisp_Object x2) | 300 | (Lisp_Object x1, Lisp_Object x2) |
| @@ -519,7 +519,7 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, | |||
| 519 | if (f1 == 0.0 && f2 == 0.0) | 519 | if (f1 == 0.0 && f2 == 0.0) |
| 520 | f1 = 1.0; | 520 | f1 = 1.0; |
| 521 | #ifdef FLOAT_CHECK_DOMAIN | 521 | #ifdef FLOAT_CHECK_DOMAIN |
| 522 | else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor(f2))) | 522 | else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor (f2))) |
| 523 | domain_error2 ("expt", arg1, arg2); | 523 | domain_error2 ("expt", arg1, arg2); |
| 524 | #endif | 524 | #endif |
| 525 | IN_FLOAT2 (f3 = pow (f1, f2), "expt", arg1, arg2); | 525 | IN_FLOAT2 (f3 = pow (f1, f2), "expt", arg1, arg2); |
| @@ -961,8 +961,7 @@ Rounds the value toward zero. */) | |||
| 961 | 961 | ||
| 962 | #ifdef FLOAT_CATCH_SIGILL | 962 | #ifdef FLOAT_CATCH_SIGILL |
| 963 | static void | 963 | static void |
| 964 | float_error (signo) | 964 | float_error (int signo) |
| 965 | int signo; | ||
| 966 | { | 965 | { |
| 967 | if (! in_float) | 966 | if (! in_float) |
| 968 | fatal_error_signal (signo); | 967 | fatal_error_signal (signo); |
| @@ -1034,8 +1033,8 @@ syms_of_floatfns (void) | |||
| 1034 | defsubr (&Scos); | 1033 | defsubr (&Scos); |
| 1035 | defsubr (&Ssin); | 1034 | defsubr (&Ssin); |
| 1036 | defsubr (&Stan); | 1035 | defsubr (&Stan); |
| 1037 | #if defined HAVE_ISNAN && defined HAVE_COPYSIGN | ||
| 1038 | defsubr (&Sisnan); | 1036 | defsubr (&Sisnan); |
| 1037 | #ifdef HAVE_COPYSIGN | ||
| 1039 | defsubr (&Scopysign); | 1038 | defsubr (&Scopysign); |
| 1040 | defsubr (&Sfrexp); | 1039 | defsubr (&Sfrexp); |
| 1041 | defsubr (&Sldexp); | 1040 | defsubr (&Sldexp); |