diff options
Diffstat (limited to 'src/floatfns.c')
| -rw-r--r-- | src/floatfns.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/floatfns.c b/src/floatfns.c index c00923643d1..b5c8b4af5c3 100644 --- a/src/floatfns.c +++ b/src/floatfns.c | |||
| @@ -103,7 +103,7 @@ extern double logb (double); | |||
| 103 | #endif | 103 | #endif |
| 104 | 104 | ||
| 105 | #ifdef FLOAT_CATCH_SIGILL | 105 | #ifdef FLOAT_CATCH_SIGILL |
| 106 | static SIGTYPE float_error (); | 106 | static void float_error (); |
| 107 | #endif | 107 | #endif |
| 108 | 108 | ||
| 109 | /* Nonzero while executing in floating point. | 109 | /* Nonzero while executing in floating point. |
| @@ -126,7 +126,7 @@ static const char *float_error_fn_name; | |||
| 126 | Handle errors which may result in signals or may set errno. | 126 | Handle errors which may result in signals or may set errno. |
| 127 | 127 | ||
| 128 | Note that float_error may be declared to return void, so you can't | 128 | Note that float_error may be declared to return void, so you can't |
| 129 | just cast the zero after the colon to (SIGTYPE) to make the types | 129 | just cast the zero after the colon to (void) to make the types |
| 130 | check properly. */ | 130 | check properly. */ |
| 131 | 131 | ||
| 132 | #ifdef FLOAT_CHECK_ERRNO | 132 | #ifdef FLOAT_CHECK_ERRNO |
| @@ -187,8 +187,10 @@ static const char *float_error_fn_name; | |||
| 187 | xsignal3 (Qrange_error, build_string ((op)), (a1), (a2)) | 187 | xsignal3 (Qrange_error, build_string ((op)), (a1), (a2)) |
| 188 | #define domain_error(op,arg) \ | 188 | #define domain_error(op,arg) \ |
| 189 | xsignal2 (Qdomain_error, build_string ((op)), (arg)) | 189 | xsignal2 (Qdomain_error, build_string ((op)), (arg)) |
| 190 | #ifdef FLOAT_CHECK_DOMAIN | ||
| 190 | #define domain_error2(op,a1,a2) \ | 191 | #define domain_error2(op,a1,a2) \ |
| 191 | xsignal3 (Qdomain_error, build_string ((op)), (a1), (a2)) | 192 | xsignal3 (Qdomain_error, build_string ((op)), (a1), (a2)) |
| 193 | #endif | ||
| 192 | 194 | ||
| 193 | /* Extract a Lisp number as a `double', or signal an error. */ | 195 | /* Extract a Lisp number as a `double', or signal an error. */ |
| 194 | 196 | ||
| @@ -326,9 +328,9 @@ If X is zero, both parts (SGNFCAND and EXP) are zero. */) | |||
| 326 | return Fcons (make_float (0.0), make_number (0)); | 328 | return Fcons (make_float (0.0), make_number (0)); |
| 327 | else | 329 | else |
| 328 | { | 330 | { |
| 329 | int exp; | 331 | int exponent; |
| 330 | double sgnfcand = frexp (f, &exp); | 332 | double sgnfcand = frexp (f, &exponent); |
| 331 | return Fcons (make_float (sgnfcand), make_number (exp)); | 333 | return Fcons (make_float (sgnfcand), make_number (exponent)); |
| 332 | } | 334 | } |
| 333 | } | 335 | } |
| 334 | 336 | ||
| @@ -336,10 +338,10 @@ DEFUN ("ldexp", Fldexp, Sldexp, 1, 2, 0, | |||
| 336 | doc: /* Construct number X from significand SGNFCAND and exponent EXP. | 338 | doc: /* Construct number X from significand SGNFCAND and exponent EXP. |
| 337 | Returns the floating point value resulting from multiplying SGNFCAND | 339 | Returns the floating point value resulting from multiplying SGNFCAND |
| 338 | (the significand) by 2 raised to the power of EXP (the exponent). */) | 340 | (the significand) by 2 raised to the power of EXP (the exponent). */) |
| 339 | (Lisp_Object sgnfcand, Lisp_Object exp) | 341 | (Lisp_Object sgnfcand, Lisp_Object exponent) |
| 340 | { | 342 | { |
| 341 | CHECK_NUMBER (exp); | 343 | CHECK_NUMBER (exponent); |
| 342 | return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exp))); | 344 | return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exponent))); |
| 343 | } | 345 | } |
| 344 | #endif | 346 | #endif |
| 345 | 347 | ||
| @@ -505,7 +507,7 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, | |||
| 505 | if (y & 1) | 507 | if (y & 1) |
| 506 | acc *= x; | 508 | acc *= x; |
| 507 | x *= x; | 509 | x *= x; |
| 508 | y = (unsigned)y >> 1; | 510 | y >>= 1; |
| 509 | } | 511 | } |
| 510 | } | 512 | } |
| 511 | XSETINT (val, acc); | 513 | XSETINT (val, acc); |
| @@ -958,7 +960,7 @@ Rounds the value toward zero. */) | |||
| 958 | } | 960 | } |
| 959 | 961 | ||
| 960 | #ifdef FLOAT_CATCH_SIGILL | 962 | #ifdef FLOAT_CATCH_SIGILL |
| 961 | static SIGTYPE | 963 | static void |
| 962 | float_error (signo) | 964 | float_error (signo) |
| 963 | int signo; | 965 | int signo; |
| 964 | { | 966 | { |
| @@ -1037,7 +1039,7 @@ syms_of_floatfns (void) | |||
| 1037 | defsubr (&Scopysign); | 1039 | defsubr (&Scopysign); |
| 1038 | defsubr (&Sfrexp); | 1040 | defsubr (&Sfrexp); |
| 1039 | defsubr (&Sldexp); | 1041 | defsubr (&Sldexp); |
| 1040 | #endif | 1042 | #endif |
| 1041 | #if 0 | 1043 | #if 0 |
| 1042 | defsubr (&Sacosh); | 1044 | defsubr (&Sacosh); |
| 1043 | defsubr (&Sasinh); | 1045 | defsubr (&Sasinh); |
| @@ -1074,4 +1076,3 @@ syms_of_floatfns (void) | |||
| 1074 | defsubr (&Sround); | 1076 | defsubr (&Sround); |
| 1075 | defsubr (&Struncate); | 1077 | defsubr (&Struncate); |
| 1076 | } | 1078 | } |
| 1077 | |||