diff options
author | Richard M. Stallman <rms@gnu.org> | 1992-06-04 04:22:08 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1992-06-04 04:22:08 +0000 |
commit | bc799da82b1bcf65f36c2b7104eb8275de11901c (patch) | |
tree | aa652a7a88e895b21f561bfb7e7a2c807e4a96ae /src/floatfns.c | |
parent | 561ce8f61a5e8dcf176d93eabb6dc0e6fd18e76b (diff) | |
download | emacs-bc799da82b1bcf65f36c2b7104eb8275de11901c.tar.gz |
*** empty log message ***
Diffstat (limited to 'src/floatfns.c')
-rw-r--r-- | src/floatfns.c | 205 |
1 files changed, 110 insertions, 95 deletions
diff --git a/src/floatfns.c b/src/floatfns.c index 20b90e63a85..c0d052aabae 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -77,6 +77,8 @@ extract_float (num) return XFLOAT (num)->data; return (double) XINT (num); } + +/* Trig functions. */ DEFUN ("acos", Facos, Sacos, 1, 1, 0, "Return the inverse cosine of ARG.") @@ -88,56 +90,58 @@ DEFUN ("acos", Facos, Sacos, 1, 1, 0, return make_float (d); } -DEFUN ("acosh", Facosh, Sacosh, 1, 1, 0, - "Return the inverse hyperbolic cosine of ARG.") +DEFUN ("asin", Fasin, Sasin, 1, 1, 0, + "Return the inverse sine of ARG.") (num) register Lisp_Object num; { double d = extract_float (num); - IN_FLOAT (d = acosh (d), num); + IN_FLOAT (d = asin (d), num); return make_float (d); } -DEFUN ("asin", Fasin, Sasin, 1, 1, 0, - "Return the inverse sine of ARG.") +DEFUN ("atan", Fatan, Satan, 1, 1, 0, + "Return the inverse tangent of ARG.") (num) register Lisp_Object num; { double d = extract_float (num); - IN_FLOAT (d = asin (d), num); + IN_FLOAT (d = atan (d), num); return make_float (d); } -DEFUN ("asinh", Fasinh, Sasinh, 1, 1, 0, - "Return the inverse hyperbolic sine of ARG.") +DEFUN ("cos", Fcos, Scos, 1, 1, 0, + "Return the cosine of ARG.") (num) register Lisp_Object num; { double d = extract_float (num); - IN_FLOAT (d = asinh (d), num); + IN_FLOAT (d = cos (d), num); return make_float (d); } -DEFUN ("atan", Fatan, Satan, 1, 1, 0, - "Return the inverse tangent of ARG.") +DEFUN ("sin", Fsin, Ssin, 1, 1, 0, + "Return the sine of ARG.") (num) register Lisp_Object num; { double d = extract_float (num); - IN_FLOAT (d = atan (d), num); + IN_FLOAT (d = sin (d), num); return make_float (d); } -DEFUN ("atanh", Fatanh, Satanh, 1, 1, 0, - "Return the inverse hyperbolic tangent of ARG.") +DEFUN ("tan", Ftan, Stan, 1, 1, 0, + "Return the tangent of ARG.") (num) register Lisp_Object num; { double d = extract_float (num); - IN_FLOAT (d = atanh (d), num); + IN_FLOAT (d = tan (d), num); return make_float (d); } +#if 0 /* Leave these out unless we find there's a reason for them. */ + DEFUN ("bessel-j0", Fbessel_j0, Sbessel_j0, 1, 1, 0, "Return the bessel function j0 of ARG.") (num) @@ -203,36 +207,10 @@ The first arg (the order) is truncated to an integer.") IN_FLOAT (f2 = yn (i1, f2), num1); return make_float (f2); } - -DEFUN ("cube-root", Fcube_root, Scube_root, 1, 1, 0, - "Return the cube root of ARG.") - (num) - register Lisp_Object num; -{ - double d = extract_float (num); - IN_FLOAT (d = cbrt (d), num); - return make_float (d); -} -DEFUN ("cos", Fcos, Scos, 1, 1, 0, - "Return the cosine of ARG.") - (num) - register Lisp_Object num; -{ - double d = extract_float (num); - IN_FLOAT (d = cos (d), num); - return make_float (d); -} - -DEFUN ("cosh", Fcosh, Scosh, 1, 1, 0, - "Return the hyperbolic cosine of ARG.") - (num) - register Lisp_Object num; -{ - double d = extract_float (num); - IN_FLOAT (d = cosh (d), num); - return make_float (d); -} +#endif + +#if 0 /* Leave these out unless we see they are worth having. */ DEFUN ("erf", Ferf, Serf, 1, 1, 0, "Return the mathematical error function of ARG.") @@ -254,26 +232,6 @@ DEFUN ("erfc", Ferfc, Serfc, 1, 1, 0, return make_float (d); } -DEFUN ("exp", Fexp, Sexp, 1, 1, 0, - "Return the exponential base e of ARG.") - (num) - register Lisp_Object num; -{ - double d = extract_float (num); - IN_FLOAT (d = exp (d), num); - return make_float (d); -} - -DEFUN ("expm1", Fexpm1, Sexpm1, 1, 1, 0, - "Return the exp (x)-1 of ARG.") - (num) - register Lisp_Object num; -{ - double d = extract_float (num); - IN_FLOAT (d = expm1 (d), num); - return make_float (d); -} - DEFUN ("log-gamma", Flog_gamma, Slog_gamma, 1, 1, 0, "Return the log gamma of ARG.") (num) @@ -284,38 +242,40 @@ DEFUN ("log-gamma", Flog_gamma, Slog_gamma, 1, 1, 0, return make_float (d); } -DEFUN ("log", Flog, Slog, 1, 1, 0, - "Return the natural logarithm of ARG.") +#endif + +DEFUN ("cube-root", Fcube_root, Scube_root, 1, 1, 0, + "Return the cube root of ARG.") (num) register Lisp_Object num; { double d = extract_float (num); - IN_FLOAT (d = log (d), num); + IN_FLOAT (d = cbrt (d), num); return make_float (d); } -DEFUN ("log10", Flog10, Slog10, 1, 1, 0, - "Return the logarithm base 10 of ARG.") +DEFUN ("exp", Fexp, Sexp, 1, 1, 0, + "Return the exponential base e of ARG.") (num) register Lisp_Object num; { double d = extract_float (num); - IN_FLOAT (d = log10 (d), num); + IN_FLOAT (d = exp (d), num); return make_float (d); } -DEFUN ("log1p", Flog1p, Slog1p, 1, 1, 0, - "Return the log (1+x) of ARG.") +DEFUN ("expm1", Fexpm1, Sexpm1, 1, 1, 0, + "Return the exp (x)-1 of ARG.") (num) register Lisp_Object num; { double d = extract_float (num); - IN_FLOAT (d = log1p (d), num); + IN_FLOAT (d = expm1 (d), num); return make_float (d); } DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, - "Return the exponential x ** y.") + "Return the exponential X ** Y.") (num1, num2) register Lisp_Object num1, num2; { @@ -349,24 +309,34 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, IN_FLOAT (f1 = pow (f1, f2), num1); return make_float (f1); } - -DEFUN ("sin", Fsin, Ssin, 1, 1, 0, - "Return the sine of ARG.") + +DEFUN ("log", Flog, Slog, 1, 1, 0, + "Return the natural logarithm of ARG.") (num) register Lisp_Object num; { double d = extract_float (num); - IN_FLOAT (d = sin (d), num); + IN_FLOAT (d = log (d), num); return make_float (d); } -DEFUN ("sinh", Fsinh, Ssinh, 1, 1, 0, - "Return the hyperbolic sine of ARG.") +DEFUN ("log10", Flog10, Slog10, 1, 1, 0, + "Return the logarithm base 10 of ARG.") (num) register Lisp_Object num; { double d = extract_float (num); - IN_FLOAT (d = sinh (d), num); + IN_FLOAT (d = log10 (d), num); + return make_float (d); +} + +DEFUN ("log1p", Flog1p, Slog1p, 1, 1, 0, + "Return the log (1+x) of ARG.") + (num) + register Lisp_Object num; +{ + double d = extract_float (num); + IN_FLOAT (d = log1p (d), num); return make_float (d); } @@ -379,14 +349,56 @@ DEFUN ("sqrt", Fsqrt, Ssqrt, 1, 1, 0, IN_FLOAT (d = sqrt (d), num); return make_float (d); } + +#ifndef /* Not clearly worth adding. */ -DEFUN ("tan", Ftan, Stan, 1, 1, 0, - "Return the tangent of ARG.") +DEFUN ("acosh", Facosh, Sacosh, 1, 1, 0, + "Return the inverse hyperbolic cosine of ARG.") (num) register Lisp_Object num; { double d = extract_float (num); - IN_FLOAT (d = tan (d), num); + IN_FLOAT (d = acosh (d), num); + return make_float (d); +} + +DEFUN ("asinh", Fasinh, Sasinh, 1, 1, 0, + "Return the inverse hyperbolic sine of ARG.") + (num) + register Lisp_Object num; +{ + double d = extract_float (num); + IN_FLOAT (d = asinh (d), num); + return make_float (d); +} + +DEFUN ("atanh", Fatanh, Satanh, 1, 1, 0, + "Return the inverse hyperbolic tangent of ARG.") + (num) + register Lisp_Object num; +{ + double d = extract_float (num); + IN_FLOAT (d = atanh (d), num); + return make_float (d); +} + +DEFUN ("cosh", Fcosh, Scosh, 1, 1, 0, + "Return the hyperbolic cosine of ARG.") + (num) + register Lisp_Object num; +{ + double d = extract_float (num); + IN_FLOAT (d = cosh (d), num); + return make_float (d); +} + +DEFUN ("sinh", Fsinh, Ssinh, 1, 1, 0, + "Return the hyperbolic sine of ARG.") + (num) + register Lisp_Object num; +{ + double d = extract_float (num); + IN_FLOAT (d = sinh (d), num); return make_float (d); } @@ -399,6 +411,7 @@ DEFUN ("tanh", Ftanh, Stanh, 1, 1, 0, IN_FLOAT (d = tanh (d), num); return make_float (d); } +#endif DEFUN ("abs", Fabs, Sabs, 1, 1, 0, "Return the absolute value of ARG.") @@ -531,34 +544,36 @@ init_floatfns () syms_of_floatfns () { defsubr (&Sacos); - defsubr (&Sacosh); defsubr (&Sasin); - defsubr (&Sasinh); defsubr (&Satan); + defsubr (&Scos); + defsubr (&Ssin); + defsubr (&Stan); +#if 0 + defsubr (&Sacosh); + defsubr (&Sasinh); defsubr (&Satanh); + defsubr (&Scosh); + defsubr (&Ssinh); + defsubr (&Stanh); defsubr (&Sbessel_y0); defsubr (&Sbessel_y1); defsubr (&Sbessel_yn); defsubr (&Sbessel_j0); defsubr (&Sbessel_j1); defsubr (&Sbessel_jn); - defsubr (&Scube_root); - defsubr (&Scos); - defsubr (&Scosh); defsubr (&Serf); defsubr (&Serfc); + defsubr (&Slog_gamma); +#endif + defsubr (&Scube_root); defsubr (&Sexp); defsubr (&Sexpm1); - defsubr (&Slog_gamma); + defsubr (&Sexpt); defsubr (&Slog); defsubr (&Slog10); defsubr (&Slog1p); - defsubr (&Sexpt); - defsubr (&Ssin); - defsubr (&Ssinh); defsubr (&Ssqrt); - defsubr (&Stan); - defsubr (&Stanh); defsubr (&Sabs); defsubr (&Sfloat); |