From: Taylor R Campbell Date: Sat, 27 Oct 2018 02:11:27 +0000 (+0000) Subject: Disable errno checking in libm functions. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~144 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=9703b3c001b8d008bd80e4b3b5678ed8f8ebe9ce;p=mit-scheme.git Disable errno checking in libm functions. If there's a floating-point exception, we have a mechanism for dealing with it -- and continuing without a trap if the user so desires. Leave in the restriction on flo:log1p and flo:expm1 because those are implementation limitations in the i386 compiler; the full functions are implemented in the runtime. --- diff --git a/src/microcode/flonum.c b/src/microcode/flonum.c index 372e12915..4d323cf15 100644 --- a/src/microcode/flonum.c +++ b/src/microcode/flonum.c @@ -29,7 +29,6 @@ USA. #include "scheme.h" #include "osscheme.h" /* error_unimplemented_primitive -- foo */ #include "prims.h" -#include double arg_flonum (int arg_number) @@ -144,10 +143,7 @@ DEFINE_PRIMITIVE ("FLONUM-NEGATIVE?", Prim_flonum_negative_p, 1, 1, 0) { \ double result; \ PRIMITIVE_HEADER (1); \ - errno = 0; \ result = (function (arg_flonum (1))); \ - if (errno != 0) \ - error_bad_range_arg (1); \ FLONUM_RESULT (result); \ } @@ -159,10 +155,7 @@ DEFINE_PRIMITIVE ("FLONUM-NEGATIVE?", Prim_flonum_negative_p, 1, 1, 0) x = (arg_flonum (1)); \ if (! (restriction)) \ error_bad_range_arg (1); \ - errno = 0; \ result = (function (x)); \ - if (errno != 0) \ - error_bad_range_arg (1); \ FLONUM_RESULT (result); \ } @@ -194,12 +187,7 @@ DEFINE_PRIMITIVE ("FLONUM-LOG", Prim_flonum_log, 1, 1, 0) double result; PRIMITIVE_HEADER (1); x = (arg_flonum (1)); - if (! (x >= 0)) - error_bad_range_arg (1); - errno = 0; result = (log (x)); - if ((errno != 0) && ((x != 0) || (errno != ERANGE))) - error_bad_range_arg (1); FLONUM_RESULT (result); } @@ -270,7 +258,6 @@ DEFINE_PRIMITIVE ("FLONUM-LGAMMA", Prim_flonum_lgamma, 1, 1, 0) PRIMITIVE_HEADER (1); x = (arg_flonum (1)); - errno = 0; #ifdef HAVE_LGAMMA_R { int sign; @@ -279,8 +266,6 @@ DEFINE_PRIMITIVE ("FLONUM-LGAMMA", Prim_flonum_lgamma, 1, 1, 0) #else result = (lgamma (x)); #endif - if (errno != 0) - error_bad_range_arg (1); FLONUM_RESULT (result); }