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.
#include "scheme.h"
#include "osscheme.h" /* error_unimplemented_primitive -- foo */
#include "prims.h"
-#include <errno.h>
double
arg_flonum (int arg_number)
{ \
double result; \
PRIMITIVE_HEADER (1); \
- errno = 0; \
result = (function (arg_flonum (1))); \
- if (errno != 0) \
- error_bad_range_arg (1); \
FLONUM_RESULT (result); \
}
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); \
}
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);
}
PRIMITIVE_HEADER (1);
x = (arg_flonum (1));
- errno = 0;
#ifdef HAVE_LGAMMA_R
{
int sign;
#else
result = (lgamma (x));
#endif
- if (errno != 0)
- error_bad_range_arg (1);
FLONUM_RESULT (result);
}