228 |
/* Trig functions. */ |
/* Trig functions. */ |
229 |
|
|
230 |
DEFUN ("acos", Facos, Sacos, 1, 1, 0, |
DEFUN ("acos", Facos, Sacos, 1, 1, 0, |
231 |
"Return the inverse cosine of ARG.") |
doc: /* Return the inverse cosine of ARG. */) |
232 |
(arg) |
(arg) |
233 |
register Lisp_Object arg; |
register Lisp_Object arg; |
234 |
{ |
{ |
235 |
double d = extract_float (arg); |
double d = extract_float (arg); |
242 |
} |
} |
243 |
|
|
244 |
DEFUN ("asin", Fasin, Sasin, 1, 1, 0, |
DEFUN ("asin", Fasin, Sasin, 1, 1, 0, |
245 |
"Return the inverse sine of ARG.") |
doc: /* Return the inverse sine of ARG. */) |
246 |
(arg) |
(arg) |
247 |
register Lisp_Object arg; |
register Lisp_Object arg; |
248 |
{ |
{ |
249 |
double d = extract_float (arg); |
double d = extract_float (arg); |
256 |
} |
} |
257 |
|
|
258 |
DEFUN ("atan", Fatan, Satan, 1, 1, 0, |
DEFUN ("atan", Fatan, Satan, 1, 1, 0, |
259 |
"Return the inverse tangent of ARG.") |
doc: /* Return the inverse tangent of ARG. */) |
260 |
(arg) |
(arg) |
261 |
register Lisp_Object arg; |
register Lisp_Object arg; |
262 |
{ |
{ |
263 |
double d = extract_float (arg); |
double d = extract_float (arg); |
266 |
} |
} |
267 |
|
|
268 |
DEFUN ("cos", Fcos, Scos, 1, 1, 0, |
DEFUN ("cos", Fcos, Scos, 1, 1, 0, |
269 |
"Return the cosine of ARG.") |
doc: /* Return the cosine of ARG. */) |
270 |
(arg) |
(arg) |
271 |
register Lisp_Object arg; |
register Lisp_Object arg; |
272 |
{ |
{ |
273 |
double d = extract_float (arg); |
double d = extract_float (arg); |
276 |
} |
} |
277 |
|
|
278 |
DEFUN ("sin", Fsin, Ssin, 1, 1, 0, |
DEFUN ("sin", Fsin, Ssin, 1, 1, 0, |
279 |
"Return the sine of ARG.") |
doc: /* Return the sine of ARG. */) |
280 |
(arg) |
(arg) |
281 |
register Lisp_Object arg; |
register Lisp_Object arg; |
282 |
{ |
{ |
283 |
double d = extract_float (arg); |
double d = extract_float (arg); |
286 |
} |
} |
287 |
|
|
288 |
DEFUN ("tan", Ftan, Stan, 1, 1, 0, |
DEFUN ("tan", Ftan, Stan, 1, 1, 0, |
289 |
"Return the tangent of ARG.") |
doc: /* Return the tangent of ARG. */) |
290 |
(arg) |
(arg) |
291 |
register Lisp_Object arg; |
register Lisp_Object arg; |
292 |
{ |
{ |
293 |
double d = extract_float (arg); |
double d = extract_float (arg); |
303 |
#if 0 /* Leave these out unless we find there's a reason for them. */ |
#if 0 /* Leave these out unless we find there's a reason for them. */ |
304 |
|
|
305 |
DEFUN ("bessel-j0", Fbessel_j0, Sbessel_j0, 1, 1, 0, |
DEFUN ("bessel-j0", Fbessel_j0, Sbessel_j0, 1, 1, 0, |
306 |
"Return the bessel function j0 of ARG.") |
doc: /* Return the bessel function j0 of ARG. */) |
307 |
(arg) |
(arg) |
308 |
register Lisp_Object arg; |
register Lisp_Object arg; |
309 |
{ |
{ |
310 |
double d = extract_float (arg); |
double d = extract_float (arg); |
313 |
} |
} |
314 |
|
|
315 |
DEFUN ("bessel-j1", Fbessel_j1, Sbessel_j1, 1, 1, 0, |
DEFUN ("bessel-j1", Fbessel_j1, Sbessel_j1, 1, 1, 0, |
316 |
"Return the bessel function j1 of ARG.") |
doc: /* Return the bessel function j1 of ARG. */) |
317 |
(arg) |
(arg) |
318 |
register Lisp_Object arg; |
register Lisp_Object arg; |
319 |
{ |
{ |
320 |
double d = extract_float (arg); |
double d = extract_float (arg); |
323 |
} |
} |
324 |
|
|
325 |
DEFUN ("bessel-jn", Fbessel_jn, Sbessel_jn, 2, 2, 0, |
DEFUN ("bessel-jn", Fbessel_jn, Sbessel_jn, 2, 2, 0, |
326 |
"Return the order N bessel function output jn of ARG.\n\ |
doc: /* Return the order N bessel function output jn of ARG. |
327 |
The first arg (the order) is truncated to an integer.") |
The first arg (the order) is truncated to an integer. */) |
328 |
(n, arg) |
(n, arg) |
329 |
register Lisp_Object n, arg; |
register Lisp_Object n, arg; |
330 |
{ |
{ |
331 |
int i1 = extract_float (n); |
int i1 = extract_float (n); |
336 |
} |
} |
337 |
|
|
338 |
DEFUN ("bessel-y0", Fbessel_y0, Sbessel_y0, 1, 1, 0, |
DEFUN ("bessel-y0", Fbessel_y0, Sbessel_y0, 1, 1, 0, |
339 |
"Return the bessel function y0 of ARG.") |
doc: /* Return the bessel function y0 of ARG. */) |
340 |
(arg) |
(arg) |
341 |
register Lisp_Object arg; |
register Lisp_Object arg; |
342 |
{ |
{ |
343 |
double d = extract_float (arg); |
double d = extract_float (arg); |
346 |
} |
} |
347 |
|
|
348 |
DEFUN ("bessel-y1", Fbessel_y1, Sbessel_y1, 1, 1, 0, |
DEFUN ("bessel-y1", Fbessel_y1, Sbessel_y1, 1, 1, 0, |
349 |
"Return the bessel function y1 of ARG.") |
doc: /* Return the bessel function y1 of ARG. */) |
350 |
(arg) |
(arg) |
351 |
register Lisp_Object arg; |
register Lisp_Object arg; |
352 |
{ |
{ |
353 |
double d = extract_float (arg); |
double d = extract_float (arg); |
356 |
} |
} |
357 |
|
|
358 |
DEFUN ("bessel-yn", Fbessel_yn, Sbessel_yn, 2, 2, 0, |
DEFUN ("bessel-yn", Fbessel_yn, Sbessel_yn, 2, 2, 0, |
359 |
"Return the order N bessel function output yn of ARG.\n\ |
doc: /* Return the order N bessel function output yn of ARG. |
360 |
The first arg (the order) is truncated to an integer.") |
The first arg (the order) is truncated to an integer. */) |
361 |
(n, arg) |
(n, arg) |
362 |
register Lisp_Object n, arg; |
register Lisp_Object n, arg; |
363 |
{ |
{ |
364 |
int i1 = extract_float (n); |
int i1 = extract_float (n); |
373 |
#if 0 /* Leave these out unless we see they are worth having. */ |
#if 0 /* Leave these out unless we see they are worth having. */ |
374 |
|
|
375 |
DEFUN ("erf", Ferf, Serf, 1, 1, 0, |
DEFUN ("erf", Ferf, Serf, 1, 1, 0, |
376 |
"Return the mathematical error function of ARG.") |
doc: /* Return the mathematical error function of ARG. */) |
377 |
(arg) |
(arg) |
378 |
register Lisp_Object arg; |
register Lisp_Object arg; |
379 |
{ |
{ |
380 |
double d = extract_float (arg); |
double d = extract_float (arg); |
383 |
} |
} |
384 |
|
|
385 |
DEFUN ("erfc", Ferfc, Serfc, 1, 1, 0, |
DEFUN ("erfc", Ferfc, Serfc, 1, 1, 0, |
386 |
"Return the complementary error function of ARG.") |
doc: /* Return the complementary error function of ARG. */) |
387 |
(arg) |
(arg) |
388 |
register Lisp_Object arg; |
register Lisp_Object arg; |
389 |
{ |
{ |
390 |
double d = extract_float (arg); |
double d = extract_float (arg); |
393 |
} |
} |
394 |
|
|
395 |
DEFUN ("log-gamma", Flog_gamma, Slog_gamma, 1, 1, 0, |
DEFUN ("log-gamma", Flog_gamma, Slog_gamma, 1, 1, 0, |
396 |
"Return the log gamma of ARG.") |
doc: /* Return the log gamma of ARG. */) |
397 |
(arg) |
(arg) |
398 |
register Lisp_Object arg; |
register Lisp_Object arg; |
399 |
{ |
{ |
400 |
double d = extract_float (arg); |
double d = extract_float (arg); |
403 |
} |
} |
404 |
|
|
405 |
DEFUN ("cube-root", Fcube_root, Scube_root, 1, 1, 0, |
DEFUN ("cube-root", Fcube_root, Scube_root, 1, 1, 0, |
406 |
"Return the cube root of ARG.") |
doc: /* Return the cube root of ARG. */) |
407 |
(arg) |
(arg) |
408 |
register Lisp_Object arg; |
register Lisp_Object arg; |
409 |
{ |
{ |
410 |
double d = extract_float (arg); |
double d = extract_float (arg); |
422 |
#endif |
#endif |
423 |
|
|
424 |
DEFUN ("exp", Fexp, Sexp, 1, 1, 0, |
DEFUN ("exp", Fexp, Sexp, 1, 1, 0, |
425 |
"Return the exponential base e of ARG.") |
doc: /* Return the exponential base e of ARG. */) |
426 |
(arg) |
(arg) |
427 |
register Lisp_Object arg; |
register Lisp_Object arg; |
428 |
{ |
{ |
429 |
double d = extract_float (arg); |
double d = extract_float (arg); |
439 |
} |
} |
440 |
|
|
441 |
DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, |
DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, |
442 |
"Return the exponential ARG1 ** ARG2.") |
doc: /* Return the exponential ARG1 ** ARG2. */) |
443 |
(arg1, arg2) |
(arg1, arg2) |
444 |
register Lisp_Object arg1, arg2; |
register Lisp_Object arg1, arg2; |
445 |
{ |
{ |
446 |
double f1, f2; |
double f1, f2; |
493 |
} |
} |
494 |
|
|
495 |
DEFUN ("log", Flog, Slog, 1, 2, 0, |
DEFUN ("log", Flog, Slog, 1, 2, 0, |
496 |
"Return the natural logarithm of ARG.\n\ |
doc: /* Return the natural logarithm of ARG. |
497 |
If second optional argument BASE is given, return log ARG using that base.") |
If second optional argument BASE is given, return log ARG using that base. */) |
498 |
(arg, base) |
(arg, base) |
499 |
register Lisp_Object arg, base; |
register Lisp_Object arg, base; |
500 |
{ |
{ |
501 |
double d = extract_float (arg); |
double d = extract_float (arg); |
523 |
} |
} |
524 |
|
|
525 |
DEFUN ("log10", Flog10, Slog10, 1, 1, 0, |
DEFUN ("log10", Flog10, Slog10, 1, 1, 0, |
526 |
"Return the logarithm base 10 of ARG.") |
doc: /* Return the logarithm base 10 of ARG. */) |
527 |
(arg) |
(arg) |
528 |
register Lisp_Object arg; |
register Lisp_Object arg; |
529 |
{ |
{ |
530 |
double d = extract_float (arg); |
double d = extract_float (arg); |
537 |
} |
} |
538 |
|
|
539 |
DEFUN ("sqrt", Fsqrt, Ssqrt, 1, 1, 0, |
DEFUN ("sqrt", Fsqrt, Ssqrt, 1, 1, 0, |
540 |
"Return the square root of ARG.") |
doc: /* Return the square root of ARG. */) |
541 |
(arg) |
(arg) |
542 |
register Lisp_Object arg; |
register Lisp_Object arg; |
543 |
{ |
{ |
544 |
double d = extract_float (arg); |
double d = extract_float (arg); |
553 |
#if 0 /* Not clearly worth adding. */ |
#if 0 /* Not clearly worth adding. */ |
554 |
|
|
555 |
DEFUN ("acosh", Facosh, Sacosh, 1, 1, 0, |
DEFUN ("acosh", Facosh, Sacosh, 1, 1, 0, |
556 |
"Return the inverse hyperbolic cosine of ARG.") |
doc: /* Return the inverse hyperbolic cosine of ARG. */) |
557 |
(arg) |
(arg) |
558 |
register Lisp_Object arg; |
register Lisp_Object arg; |
559 |
{ |
{ |
560 |
double d = extract_float (arg); |
double d = extract_float (arg); |
571 |
} |
} |
572 |
|
|
573 |
DEFUN ("asinh", Fasinh, Sasinh, 1, 1, 0, |
DEFUN ("asinh", Fasinh, Sasinh, 1, 1, 0, |
574 |
"Return the inverse hyperbolic sine of ARG.") |
doc: /* Return the inverse hyperbolic sine of ARG. */) |
575 |
(arg) |
(arg) |
576 |
register Lisp_Object arg; |
register Lisp_Object arg; |
577 |
{ |
{ |
578 |
double d = extract_float (arg); |
double d = extract_float (arg); |
585 |
} |
} |
586 |
|
|
587 |
DEFUN ("atanh", Fatanh, Satanh, 1, 1, 0, |
DEFUN ("atanh", Fatanh, Satanh, 1, 1, 0, |
588 |
"Return the inverse hyperbolic tangent of ARG.") |
doc: /* Return the inverse hyperbolic tangent of ARG. */) |
589 |
(arg) |
(arg) |
590 |
register Lisp_Object arg; |
register Lisp_Object arg; |
591 |
{ |
{ |
592 |
double d = extract_float (arg); |
double d = extract_float (arg); |
603 |
} |
} |
604 |
|
|
605 |
DEFUN ("cosh", Fcosh, Scosh, 1, 1, 0, |
DEFUN ("cosh", Fcosh, Scosh, 1, 1, 0, |
606 |
"Return the hyperbolic cosine of ARG.") |
doc: /* Return the hyperbolic cosine of ARG. */) |
607 |
(arg) |
(arg) |
608 |
register Lisp_Object arg; |
register Lisp_Object arg; |
609 |
{ |
{ |
610 |
double d = extract_float (arg); |
double d = extract_float (arg); |
617 |
} |
} |
618 |
|
|
619 |
DEFUN ("sinh", Fsinh, Ssinh, 1, 1, 0, |
DEFUN ("sinh", Fsinh, Ssinh, 1, 1, 0, |
620 |
"Return the hyperbolic sine of ARG.") |
doc: /* Return the hyperbolic sine of ARG. */) |
621 |
(arg) |
(arg) |
622 |
register Lisp_Object arg; |
register Lisp_Object arg; |
623 |
{ |
{ |
624 |
double d = extract_float (arg); |
double d = extract_float (arg); |
631 |
} |
} |
632 |
|
|
633 |
DEFUN ("tanh", Ftanh, Stanh, 1, 1, 0, |
DEFUN ("tanh", Ftanh, Stanh, 1, 1, 0, |
634 |
"Return the hyperbolic tangent of ARG.") |
doc: /* Return the hyperbolic tangent of ARG. */) |
635 |
(arg) |
(arg) |
636 |
register Lisp_Object arg; |
register Lisp_Object arg; |
637 |
{ |
{ |
638 |
double d = extract_float (arg); |
double d = extract_float (arg); |
642 |
#endif |
#endif |
643 |
|
|
644 |
DEFUN ("abs", Fabs, Sabs, 1, 1, 0, |
DEFUN ("abs", Fabs, Sabs, 1, 1, 0, |
645 |
"Return the absolute value of ARG.") |
doc: /* Return the absolute value of ARG. */) |
646 |
(arg) |
(arg) |
647 |
register Lisp_Object arg; |
register Lisp_Object arg; |
648 |
{ |
{ |
649 |
CHECK_NUMBER_OR_FLOAT (arg); |
CHECK_NUMBER_OR_FLOAT (arg); |
657 |
} |
} |
658 |
|
|
659 |
DEFUN ("float", Ffloat, Sfloat, 1, 1, 0, |
DEFUN ("float", Ffloat, Sfloat, 1, 1, 0, |
660 |
"Return the floating point number equal to ARG.") |
doc: /* Return the floating point number equal to ARG. */) |
661 |
(arg) |
(arg) |
662 |
register Lisp_Object arg; |
register Lisp_Object arg; |
663 |
{ |
{ |
664 |
CHECK_NUMBER_OR_FLOAT (arg); |
CHECK_NUMBER_OR_FLOAT (arg); |
670 |
} |
} |
671 |
|
|
672 |
DEFUN ("logb", Flogb, Slogb, 1, 1, 0, |
DEFUN ("logb", Flogb, Slogb, 1, 1, 0, |
673 |
"Returns largest integer <= the base 2 log of the magnitude of ARG.\n\ |
doc: /* Returns largest integer <= the base 2 log of the magnitude of ARG. |
674 |
This is the same as the exponent of a float.") |
This is the same as the exponent of a float. */) |
675 |
(arg) |
(arg) |
676 |
Lisp_Object arg; |
Lisp_Object arg; |
677 |
{ |
{ |
838 |
} |
} |
839 |
|
|
840 |
DEFUN ("ceiling", Fceiling, Sceiling, 1, 2, 0, |
DEFUN ("ceiling", Fceiling, Sceiling, 1, 2, 0, |
841 |
"Return the smallest integer no less than ARG. (Round toward +inf.)\n\ |
doc: /* Return the smallest integer no less than ARG. (Round toward +inf.) |
842 |
With optional DIVISOR, return the smallest integer no less than ARG/DIVISOR.") |
With optional DIVISOR, return the smallest integer no less than ARG/DIVISOR. */) |
843 |
(arg, divisor) |
(arg, divisor) |
844 |
Lisp_Object arg, divisor; |
Lisp_Object arg, divisor; |
845 |
{ |
{ |
846 |
return rounding_driver (arg, divisor, ceil, ceiling2, "ceiling"); |
return rounding_driver (arg, divisor, ceil, ceiling2, "ceiling"); |
847 |
} |
} |
848 |
|
|
849 |
DEFUN ("floor", Ffloor, Sfloor, 1, 2, 0, |
DEFUN ("floor", Ffloor, Sfloor, 1, 2, 0, |
850 |
"Return the largest integer no greater than ARG. (Round towards -inf.)\n\ |
doc: /* Return the largest integer no greater than ARG. (Round towards -inf.) |
851 |
With optional DIVISOR, return the largest integer no greater than ARG/DIVISOR.") |
With optional DIVISOR, return the largest integer no greater than ARG/DIVISOR. */) |
852 |
(arg, divisor) |
(arg, divisor) |
853 |
Lisp_Object arg, divisor; |
Lisp_Object arg, divisor; |
854 |
{ |
{ |
855 |
return rounding_driver (arg, divisor, floor, floor2, "floor"); |
return rounding_driver (arg, divisor, floor, floor2, "floor"); |
856 |
} |
} |
857 |
|
|
858 |
DEFUN ("round", Fround, Sround, 1, 2, 0, |
DEFUN ("round", Fround, Sround, 1, 2, 0, |
859 |
"Return the nearest integer to ARG.\n\ |
doc: /* Return the nearest integer to ARG. |
860 |
With optional DIVISOR, return the nearest integer to ARG/DIVISOR.") |
With optional DIVISOR, return the nearest integer to ARG/DIVISOR. */) |
861 |
(arg, divisor) |
(arg, divisor) |
862 |
Lisp_Object arg, divisor; |
Lisp_Object arg, divisor; |
863 |
{ |
{ |
864 |
return rounding_driver (arg, divisor, emacs_rint, round2, "round"); |
return rounding_driver (arg, divisor, emacs_rint, round2, "round"); |
865 |
} |
} |
866 |
|
|
867 |
DEFUN ("truncate", Ftruncate, Struncate, 1, 2, 0, |
DEFUN ("truncate", Ftruncate, Struncate, 1, 2, 0, |
868 |
"Truncate a floating point number to an int.\n\ |
doc: /* Truncate a floating point number to an int. |
869 |
Rounds ARG toward zero.\n\ |
Rounds ARG toward zero. |
870 |
With optional DIVISOR, truncate ARG/DIVISOR.") |
With optional DIVISOR, truncate ARG/DIVISOR. */) |
871 |
(arg, divisor) |
(arg, divisor) |
872 |
Lisp_Object arg, divisor; |
Lisp_Object arg, divisor; |
873 |
{ |
{ |
874 |
return rounding_driver (arg, divisor, double_identity, truncate2, |
return rounding_driver (arg, divisor, double_identity, truncate2, |
898 |
/* It's not clear these are worth adding. */ |
/* It's not clear these are worth adding. */ |
899 |
|
|
900 |
DEFUN ("fceiling", Ffceiling, Sfceiling, 1, 1, 0, |
DEFUN ("fceiling", Ffceiling, Sfceiling, 1, 1, 0, |
901 |
"Return the smallest integer no less than ARG, as a float.\n\ |
doc: /* Return the smallest integer no less than ARG, as a float. |
902 |
\(Round toward +inf.\)") |
\(Round toward +inf.\) */) |
903 |
(arg) |
(arg) |
904 |
register Lisp_Object arg; |
register Lisp_Object arg; |
905 |
{ |
{ |
906 |
double d = extract_float (arg); |
double d = extract_float (arg); |
909 |
} |
} |
910 |
|
|
911 |
DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0, |
DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0, |
912 |
"Return the largest integer no greater than ARG, as a float.\n\ |
doc: /* Return the largest integer no greater than ARG, as a float. |
913 |
\(Round towards -inf.\)") |
\(Round towards -inf.\) */) |
914 |
(arg) |
(arg) |
915 |
register Lisp_Object arg; |
register Lisp_Object arg; |
916 |
{ |
{ |
917 |
double d = extract_float (arg); |
double d = extract_float (arg); |
920 |
} |
} |
921 |
|
|
922 |
DEFUN ("fround", Ffround, Sfround, 1, 1, 0, |
DEFUN ("fround", Ffround, Sfround, 1, 1, 0, |
923 |
"Return the nearest integer to ARG, as a float.") |
doc: /* Return the nearest integer to ARG, as a float. */) |
924 |
(arg) |
(arg) |
925 |
register Lisp_Object arg; |
register Lisp_Object arg; |
926 |
{ |
{ |
927 |
double d = extract_float (arg); |
double d = extract_float (arg); |
930 |
} |
} |
931 |
|
|
932 |
DEFUN ("ftruncate", Fftruncate, Sftruncate, 1, 1, 0, |
DEFUN ("ftruncate", Fftruncate, Sftruncate, 1, 1, 0, |
933 |
"Truncate a floating point number to an integral float value.\n\ |
doc: /* Truncate a floating point number to an integral float value. |
934 |
Rounds the value toward zero.") |
Rounds the value toward zero. */) |
935 |
(arg) |
(arg) |
936 |
register Lisp_Object arg; |
register Lisp_Object arg; |
937 |
{ |
{ |
938 |
double d = extract_float (arg); |
double d = extract_float (arg); |