DEFINE_PRIMITIVE ("FLONUM-EXP", Prim_flonum_exp, 1, 1, 0)
SIMPLE_TRANSCENDENTAL_FUNCTION (exp)
+\f
+DEFINE_PRIMITIVE ("FLONUM-SINH", Prim_flonum_sinh, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (sinh)
+DEFINE_PRIMITIVE ("FLONUM-COSH", Prim_flonum_cosh, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (cosh)
+DEFINE_PRIMITIVE ("FLONUM-TANH", Prim_flonum_tanh, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (tanh)
+DEFINE_PRIMITIVE ("FLONUM-ASINH", Prim_flonum_asinh, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (asinh)
+DEFINE_PRIMITIVE ("FLONUM-ACOSH", Prim_flonum_acosh, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (acosh)
+DEFINE_PRIMITIVE ("FLONUM-ATANH", Prim_flonum_atanh, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (atanh)
+
DEFINE_PRIMITIVE ("FLONUM-SIN", Prim_flonum_sin, 1, 1, 0)
SIMPLE_TRANSCENDENTAL_FUNCTION (sin)
DEFINE_PRIMITIVE ("FLONUM-COS", Prim_flonum_cos, 1, 1, 0)
DEFINE_PRIMITIVE ("FLONUM-SQRT", Prim_flonum_sqrt, 1, 1, 0)
RESTRICTED_TRANSCENDENTAL_FUNCTION (sqrt, (x >= 0))
+DEFINE_PRIMITIVE ("FLONUM-CBRT", Prim_flonum_cbrt, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (cbrt)
+
+DEFINE_PRIMITIVE ("FLONUM-HYPOT", Prim_flonum_hypot, 2, 2, 0)
+{
+ PRIMITIVE_HEADER (2);
+ FLONUM_RESULT (hypot ((arg_flonum (1)), (arg_flonum (2))));
+}
DEFINE_PRIMITIVE ("FLONUM-EXPT", Prim_flonum_expt, 2, 2, 0)
{
FLONUM_RESULT (pow ((arg_flonum (1)), (arg_flonum (2))));
}
\f
+/* (Complete) Gamma and error functions */
+
+DEFINE_PRIMITIVE ("FLONUM-LGAMMA", Prim_flonum_lgamma, 1, 1, 0)
+{
+ double x;
+ double result;
+ PRIMITIVE_HEADER (1);
+
+ x = (arg_flonum (1));
+ errno = 0;
+#ifdef HAVE_LGAMMA_R
+ {
+ int sign;
+ result = (lgamma_r (x, (&sign)));
+ }
+#else
+ result = (lgamma (x));
+#endif
+ if (errno != 0)
+ error_bad_range_arg (1);
+ FLONUM_RESULT (result);
+}
+
+DEFINE_PRIMITIVE ("FLONUM-GAMMA", Prim_flonum_gamma, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (tgamma)
+DEFINE_PRIMITIVE ("FLONUM-ERF", Prim_flonum_erf, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (erf)
+DEFINE_PRIMITIVE ("FLONUM-ERFC", Prim_flonum_erfc, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (erfc)
+
+/* Bessel functions of the first (j*) and second (y*) kind */
+
+DEFINE_PRIMITIVE ("FLONUM-J0", Prim_flonum_j0, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (j0)
+DEFINE_PRIMITIVE ("FLONUM-J1", Prim_flonum_j1, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (j1)
+DEFINE_PRIMITIVE ("FLONUM-Y0", Prim_flonum_y0, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (y0)
+DEFINE_PRIMITIVE ("FLONUM-Y1", Prim_flonum_y1, 1, 1, 0)
+ SIMPLE_TRANSCENDENTAL_FUNCTION (y1)
+
+DEFINE_PRIMITIVE ("FLONUM-JN", Prim_flonum_jn, 2, 2, 0)
+{
+ int n;
+ double x;
+ PRIMITIVE_HEADER (2);
+ n = (arg_integer_in_range (1, INT_MIN, INT_MAX));
+ x = (arg_flonum (2));
+ FLONUM_RESULT (jn (n, x));
+}
+
+DEFINE_PRIMITIVE ("FLONUM-YN", Prim_flonum_yn, 2, 2, 0)
+{
+ int n;
+ double x;
+ PRIMITIVE_HEADER (2);
+ n = (arg_integer_in_range (1, INT_MIN, INT_MAX));
+ x = (arg_flonum (2));
+ FLONUM_RESULT (yn (n, x));
+}
+\f
DEFINE_PRIMITIVE ("FLONUM?", Prim_flonum_p, 1, 1, 0)
{
PRIMITIVE_HEADER (1);
PRIMITIVE_RETURN (double_to_flonum ((double) cast.f));
}
}
+\f
+/* Miscellaneous floating-point operations */
+
+DEFINE_PRIMITIVE ("FLONUM-COPYSIGN", Prim_flonum_copysign, 2, 2, 0)
+{
+ PRIMITIVE_HEADER (2);
+ {
+ double magnitude = (arg_flonum (1));
+ double sign = (arg_flonum (2));
+ FLONUM_RESULT (copysign (magnitude, sign));
+ }
+}
+
+DEFINE_PRIMITIVE ("FLONUM-NEXTAFTER", Prim_flonum_nextafter, 2, 2, 0)
+{
+ PRIMITIVE_HEADER (2);
+ {
+ double x = (arg_flonum (1));
+ double direction = (arg_flonum (2));
+ FLONUM_RESULT (nextafter (x, direction));
+ }
+}
(flo:sin flonum-sin 1)
(flo:cos flonum-cos 1)
(flo:tan flonum-tan 1)
+ (flo:sinh flonum-sinh 1)
+ (flo:cosh flonum-cosh 1)
+ (flo:tanh flonum-tanh 1)
(flo:asin flonum-asin 1)
(flo:acos flonum-acos 1)
(flo:atan flonum-atan 1)
+ (flo:asinh flonum-asinh 1)
+ (flo:acosh flonum-acosh 1)
+ (flo:atanh flonum-atanh 1)
(flo:atan2 flonum-atan2 2)
(flo:sqrt flonum-sqrt 1)
+ (flo:cbrt flonum-cbrt 1)
+ (flo:hypot flonum-hypot 2)
(flo:expt flonum-expt 2)
+ (flo:lgamma flonum-lgamma 1)
+ (flo:gamma flonum-gamma 1)
+ (flo:erf flonum-erf 1)
+ (flo:erfc flonum-erfc 1)
+ (flo:j0 flonum-j0 1)
+ (flo:j1 flonum-j1 1)
+ (flo:jn flonum-jn 2)
+ (flo:y0 flonum-y0 1)
+ (flo:y1 flonum-y1 1)
+ (flo:yn flonum-yn 2)
(flo:floor flonum-floor 1)
(flo:ceiling flonum-ceiling 1)
(flo:truncate flonum-truncate 1)
(flo:ceiling->exact flonum-ceiling->exact 1)
(flo:truncate->exact flonum-truncate->exact 1)
(flo:round->exact flonum-round->exact 1)
+ (flo:copysign flonum-copysign 2)
+ (flo:nextafter flonum-nextafter 2)
(flo:vector-cons floating-vector-cons 1)
(flo:vector-length floating-vector-length 1)
(flo:vector-ref floating-vector-ref 2)