annotate src/floatfns.c @ 14472:8979515dac09 libc-960203 libc-960204 libc-960205 libc-960206 libc-960207 libc-960208 libc-960209 libc-960210

Add cygwin32; Put eabi .sdata2/.sbss2 into read-only memory
author Michael Meissner <gnu@the-meissners.org>
date Sat, 03 Feb 1996 01:03:27 +0000
parents ee40177f6c68
children c037294d6e47
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
1 /* Primitive operations on floating point for GNU Emacs Lisp interpreter.
7307
cd81dba38a49 Update copyright.
Karl Heuer <kwzh@gnu.org>
parents: 7205
diff changeset
2 Copyright (C) 1988, 1993, 1994 Free Software Foundation, Inc.
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
3
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
4 This file is part of GNU Emacs.
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
5
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
9 any later version.
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
10
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
14 GNU General Public License for more details.
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
15
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14076
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 14076
diff changeset
19 Boston, MA 02111-1307, USA. */
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
20
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
21
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
22 /* ANSI C requires only these float functions:
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
23 acos, asin, atan, atan2, ceil, cos, cosh, exp, fabs, floor, fmod,
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
24 frexp, ldexp, log, log10, modf, pow, sin, sinh, sqrt, tan, tanh.
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
25
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
26 Define HAVE_INVERSE_HYPERBOLIC if you have acosh, asinh, and atanh.
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
27 Define HAVE_CBRT if you have cbrt.
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
28 Define HAVE_RINT if you have rint.
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
29 If you don't define these, then the appropriate routines will be simulated.
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
30
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
31 Define HAVE_MATHERR if on a system supporting the SysV matherr callback.
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
32 (This should happen automatically.)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
33
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
34 Define FLOAT_CHECK_ERRNO if the float library routines set errno.
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
35 This has no effect if HAVE_MATHERR is defined.
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
36
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
37 Define FLOAT_CATCH_SIGILL if the float library routines signal SIGILL.
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
38 (What systems actually do this? Please let us know.)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
39
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
40 Define FLOAT_CHECK_DOMAIN if the float library doesn't handle errors by
14036
621a575db6f7 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 13442
diff changeset
41 either setting errno, or signaling SIGFPE/SIGILL. Otherwise, domain and
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
42 range checking will happen before calling the float routines. This has
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
43 no effect if HAVE_MATHERR is defined (since matherr will be called when
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
44 a domain error occurs.)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
45 */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
46
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
47 #include <signal.h>
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
48
4696
1fc792473491 Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents: 4594
diff changeset
49 #include <config.h>
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
50 #include "lisp.h"
638
40b255f55df3 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 624
diff changeset
51 #include "syssignal.h"
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
52
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
53 Lisp_Object Qarith_error;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
54
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
55 #ifdef LISP_FLOAT_TYPE
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
56
4843
136e32c763e3 [hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
57 /* Work around a problem that happens because math.h on hpux 7
136e32c763e3 [hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
58 defines two static variables--which, in Emacs, are not really static,
136e32c763e3 [hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
59 because `static' is defined as nothing. The problem is that they are
136e32c763e3 [hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
60 defined both here and in lread.c.
136e32c763e3 [hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
61 These macros prevent the name conflict. */
136e32c763e3 [hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
62 #if defined (HPUX) && !defined (HPUX8)
136e32c763e3 [hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
63 #define _MAXLDBL floatfns_maxldbl
136e32c763e3 [hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
64 #define _NMAXLDBL floatfns_nmaxldbl
136e32c763e3 [hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
65 #endif
136e32c763e3 [hpux 7] (_MAXLDBL, _NMAXLDBL): New macro definitions.
Richard M. Stallman <rms@gnu.org>
parents: 4696
diff changeset
66
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
67 #include <math.h>
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
68
4881
e53d4ae93675 Declare `logb' only if HAVE_LOGB is defined.
Brian Fox <bfox@gnu.org>
parents: 4843
diff changeset
69 /* This declaration is omitted on some systems, like Ultrix. */
7448
bf93ac2d8409 Don't declare logb if it is a macro.
Richard M. Stallman <rms@gnu.org>
parents: 7361
diff changeset
70 #if !defined (HPUX) && defined (HAVE_LOGB) && !defined (logb)
2205
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
71 extern double logb ();
7448
bf93ac2d8409 Don't declare logb if it is a macro.
Richard M. Stallman <rms@gnu.org>
parents: 7361
diff changeset
72 #endif /* not HPUX and HAVE_LOGB and no logb macro */
2205
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
73
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
74 #if defined(DOMAIN) && defined(SING) && defined(OVERFLOW)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
75 /* If those are defined, then this is probably a `matherr' machine. */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
76 # ifndef HAVE_MATHERR
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
77 # define HAVE_MATHERR
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
78 # endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
79 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
80
3027
7ed290bef028 Fix typo in last change.
Richard M. Stallman <rms@gnu.org>
parents: 3025
diff changeset
81 #ifdef NO_MATHERR
3025
d09f68ccd145 [NO_MATHERR]: Undef HAVE_MATHERR.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
82 #undef HAVE_MATHERR
d09f68ccd145 [NO_MATHERR]: Undef HAVE_MATHERR.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
83 #endif
d09f68ccd145 [NO_MATHERR]: Undef HAVE_MATHERR.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
84
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
85 #ifdef HAVE_MATHERR
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
86 # ifdef FLOAT_CHECK_ERRNO
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
87 # undef FLOAT_CHECK_ERRNO
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
88 # endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
89 # ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
90 # undef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
91 # endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
92 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
93
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
94 #ifndef NO_FLOAT_CHECK_ERRNO
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
95 #define FLOAT_CHECK_ERRNO
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
96 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
97
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
98 #ifdef FLOAT_CHECK_ERRNO
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
99 # include <errno.h>
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
100
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
101 extern int errno;
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
102 #endif
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
103
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
104 /* Avoid traps on VMS from sinh and cosh.
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
105 All the other functions set errno instead. */
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
106
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
107 #ifdef VMS
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
108 #undef cosh
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
109 #undef sinh
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
110 #define cosh(x) ((exp(x)+exp(-x))*0.5)
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
111 #define sinh(x) ((exp(x)-exp(-x))*0.5)
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
112 #endif /* VMS */
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
113
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
114 #ifndef HAVE_RINT
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
115 #define rint(x) (floor((x)+0.5))
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
116 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
117
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
118 static SIGTYPE float_error ();
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
119
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
120 /* Nonzero while executing in floating point.
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
121 This tells float_error what to do. */
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
122
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
123 static int in_float;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
124
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
125 /* If an argument is out of range for a mathematical function,
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
126 here is the actual argument value to use in the error message. */
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
127
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
128 static Lisp_Object float_error_arg, float_error_arg2;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
129
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
130 static char *float_error_fn_name;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
131
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
132 /* Evaluate the floating point expression D, recording NUM
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
133 as the original argument for error messages.
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
134 D is normally an assignment expression.
1918
699ae3079c09 * floatfns.c (Flogb): Always implement this by calling Flog, even
Jim Blandy <jimb@redhat.com>
parents: 1715
diff changeset
135 Handle errors which may result in signals or may set errno.
699ae3079c09 * floatfns.c (Flogb): Always implement this by calling Flog, even
Jim Blandy <jimb@redhat.com>
parents: 1715
diff changeset
136
699ae3079c09 * floatfns.c (Flogb): Always implement this by calling Flog, even
Jim Blandy <jimb@redhat.com>
parents: 1715
diff changeset
137 Note that float_error may be declared to return void, so you can't
699ae3079c09 * floatfns.c (Flogb): Always implement this by calling Flog, even
Jim Blandy <jimb@redhat.com>
parents: 1715
diff changeset
138 just cast the zero after the colon to (SIGTYPE) to make the types
699ae3079c09 * floatfns.c (Flogb): Always implement this by calling Flog, even
Jim Blandy <jimb@redhat.com>
parents: 1715
diff changeset
139 check properly. */
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
140
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
141 #ifdef FLOAT_CHECK_ERRNO
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
142 #define IN_FLOAT(d, name, num) \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
143 do { \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
144 float_error_arg = num; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
145 float_error_fn_name = name; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
146 in_float = 1; errno = 0; (d); in_float = 0; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
147 switch (errno) { \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
148 case 0: break; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
149 case EDOM: domain_error (float_error_fn_name, float_error_arg); \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
150 case ERANGE: range_error (float_error_fn_name, float_error_arg); \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
151 default: arith_error (float_error_fn_name, float_error_arg); \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
152 } \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
153 } while (0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
154 #define IN_FLOAT2(d, name, num, num2) \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
155 do { \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
156 float_error_arg = num; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
157 float_error_arg2 = num2; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
158 float_error_fn_name = name; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
159 in_float = 1; errno = 0; (d); in_float = 0; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
160 switch (errno) { \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
161 case 0: break; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
162 case EDOM: domain_error (float_error_fn_name, float_error_arg); \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
163 case ERANGE: range_error (float_error_fn_name, float_error_arg); \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
164 default: arith_error (float_error_fn_name, float_error_arg); \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
165 } \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
166 } while (0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
167 #else
3407
d00aaf536bfd [!FLOAT_CHECK_ERRNO] (IN_FLOAT): New definition.
Richard M. Stallman <rms@gnu.org>
parents: 3094
diff changeset
168 #define IN_FLOAT(d, name, num) (in_float = 1, (d), in_float = 0)
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
169 #define IN_FLOAT2(d, name, num, num2) (in_float = 1, (d), in_float = 0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
170 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
171
6375
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
172 /* Convert float to Lisp_Int if it fits, else signal a range error
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
173 using the given arguments. */
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
174 #define FLOAT_TO_INT(x, i, name, num) \
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
175 do \
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
176 { \
8825
5e5f6d06fb5b (FLOAT_TO_INT, FLOAT_TO_INT2): Use EMACS_INT.
Richard M. Stallman <rms@gnu.org>
parents: 7448
diff changeset
177 if ((x) >= (((EMACS_INT) 1) << (VALBITS-1)) || \
5e5f6d06fb5b (FLOAT_TO_INT, FLOAT_TO_INT2): Use EMACS_INT.
Richard M. Stallman <rms@gnu.org>
parents: 7448
diff changeset
178 (x) <= - (((EMACS_INT) 1) << (VALBITS-1)) - 1) \
6375
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
179 range_error (name, num); \
9267
1b685d477c10 (FLOAT_TO_INT, FLOAT_TO_INT2, Fexpt, Flogb, Ffloor): Use new accessor macros
Karl Heuer <kwzh@gnu.org>
parents: 9129
diff changeset
180 XSETINT (i, (EMACS_INT)(x)); \
6375
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
181 } \
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
182 while (0)
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
183 #define FLOAT_TO_INT2(x, i, name, num1, num2) \
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
184 do \
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
185 { \
8825
5e5f6d06fb5b (FLOAT_TO_INT, FLOAT_TO_INT2): Use EMACS_INT.
Richard M. Stallman <rms@gnu.org>
parents: 7448
diff changeset
186 if ((x) >= (((EMACS_INT) 1) << (VALBITS-1)) || \
5e5f6d06fb5b (FLOAT_TO_INT, FLOAT_TO_INT2): Use EMACS_INT.
Richard M. Stallman <rms@gnu.org>
parents: 7448
diff changeset
187 (x) <= - (((EMACS_INT) 1) << (VALBITS-1)) - 1) \
6375
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
188 range_error2 (name, num1, num2); \
9267
1b685d477c10 (FLOAT_TO_INT, FLOAT_TO_INT2, Fexpt, Flogb, Ffloor): Use new accessor macros
Karl Heuer <kwzh@gnu.org>
parents: 9129
diff changeset
189 XSETINT (i, (EMACS_INT)(x)); \
6375
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
190 } \
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
191 while (0)
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
192
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
193 #define arith_error(op,arg) \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
194 Fsignal (Qarith_error, Fcons (build_string ((op)), Fcons ((arg), Qnil)))
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
195 #define range_error(op,arg) \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
196 Fsignal (Qrange_error, Fcons (build_string ((op)), Fcons ((arg), Qnil)))
6375
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
197 #define range_error2(op,a1,a2) \
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
198 Fsignal (Qrange_error, Fcons (build_string ((op)), \
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
199 Fcons ((a1), Fcons ((a2), Qnil))))
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
200 #define domain_error(op,arg) \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
201 Fsignal (Qdomain_error, Fcons (build_string ((op)), Fcons ((arg), Qnil)))
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
202 #define domain_error2(op,a1,a2) \
6375
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
203 Fsignal (Qdomain_error, Fcons (build_string ((op)), \
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
204 Fcons ((a1), Fcons ((a2), Qnil))))
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
205
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
206 /* Extract a Lisp number as a `double', or signal an error. */
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
207
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
208 double
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
209 extract_float (num)
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
210 Lisp_Object num;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
211 {
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
212 CHECK_NUMBER_OR_FLOAT (num, 0);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
213
9129
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
214 if (FLOATP (num))
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
215 return XFLOAT (num)->data;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
216 return (double) XINT (num);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
217 }
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
218
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
219 /* Trig functions. */
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
220
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
221 DEFUN ("acos", Facos, Sacos, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
222 "Return the inverse cosine of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
223 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
224 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
225 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
226 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
227 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
228 if (d > 1.0 || d < -1.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
229 domain_error ("acos", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
230 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
231 IN_FLOAT (d = acos (d), "acos", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
232 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
233 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
234
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
235 DEFUN ("asin", Fasin, Sasin, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
236 "Return the inverse sine of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
237 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
238 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
239 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
240 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
241 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
242 if (d > 1.0 || d < -1.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
243 domain_error ("asin", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
244 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
245 IN_FLOAT (d = asin (d), "asin", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
246 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
247 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
248
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
249 DEFUN ("atan", Fatan, Satan, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
250 "Return the inverse tangent of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
251 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
252 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
253 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
254 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
255 IN_FLOAT (d = atan (d), "atan", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
256 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
257 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
258
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
259 DEFUN ("cos", Fcos, Scos, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
260 "Return the cosine of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
261 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
262 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
263 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
264 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
265 IN_FLOAT (d = cos (d), "cos", arg);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
266 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
267 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
268
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
269 DEFUN ("sin", Fsin, Ssin, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
270 "Return the sine of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
271 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
272 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
273 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
274 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
275 IN_FLOAT (d = sin (d), "sin", arg);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
276 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
277 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
278
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
279 DEFUN ("tan", Ftan, Stan, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
280 "Return the tangent of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
281 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
282 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
283 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
284 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
285 double c = cos (d);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
286 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
287 if (c == 0.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
288 domain_error ("tan", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
289 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
290 IN_FLOAT (d = sin (d) / c, "tan", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
291 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
292 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
293
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
294 #if 0 /* Leave these out unless we find there's a reason for them. */
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
295
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
296 DEFUN ("bessel-j0", Fbessel_j0, Sbessel_j0, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
297 "Return the bessel function j0 of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
298 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
299 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
300 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
301 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
302 IN_FLOAT (d = j0 (d), "bessel-j0", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
303 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
304 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
305
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
306 DEFUN ("bessel-j1", Fbessel_j1, Sbessel_j1, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
307 "Return the bessel function j1 of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
308 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
309 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
310 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
311 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
312 IN_FLOAT (d = j1 (d), "bessel-j1", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
313 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
314 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
315
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
316 DEFUN ("bessel-jn", Fbessel_jn, Sbessel_jn, 2, 2, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
317 "Return the order N bessel function output jn of ARG.\n\
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
318 The first arg (the order) is truncated to an integer.")
14076
b339e9aaea4b (Fbessel_jn, Fbessel_yn): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
319 (n, arg)
b339e9aaea4b (Fbessel_jn, Fbessel_yn): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
320 register Lisp_Object n, arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
321 {
14076
b339e9aaea4b (Fbessel_jn, Fbessel_yn): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
322 int i1 = extract_float (n);
b339e9aaea4b (Fbessel_jn, Fbessel_yn): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
323 double f2 = extract_float (arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
324
14076
b339e9aaea4b (Fbessel_jn, Fbessel_yn): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
325 IN_FLOAT (f2 = jn (i1, f2), "bessel-jn", n);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
326 return make_float (f2);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
327 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
328
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
329 DEFUN ("bessel-y0", Fbessel_y0, Sbessel_y0, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
330 "Return the bessel function y0 of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
331 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
332 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
333 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
334 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
335 IN_FLOAT (d = y0 (d), "bessel-y0", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
336 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
337 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
338
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
339 DEFUN ("bessel-y1", Fbessel_y1, Sbessel_y1, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
340 "Return the bessel function y1 of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
341 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
342 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
343 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
344 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
345 IN_FLOAT (d = y1 (d), "bessel-y0", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
346 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
347 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
348
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
349 DEFUN ("bessel-yn", Fbessel_yn, Sbessel_yn, 2, 2, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
350 "Return the order N bessel function output yn of ARG.\n\
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
351 The first arg (the order) is truncated to an integer.")
14076
b339e9aaea4b (Fbessel_jn, Fbessel_yn): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
352 (n, arg)
b339e9aaea4b (Fbessel_jn, Fbessel_yn): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
353 register Lisp_Object n, arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
354 {
14076
b339e9aaea4b (Fbessel_jn, Fbessel_yn): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
355 int i1 = extract_float (n);
b339e9aaea4b (Fbessel_jn, Fbessel_yn): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
356 double f2 = extract_float (arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
357
14076
b339e9aaea4b (Fbessel_jn, Fbessel_yn): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents: 14036
diff changeset
358 IN_FLOAT (f2 = yn (i1, f2), "bessel-yn", n);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
359 return make_float (f2);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
360 }
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
361
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
362 #endif
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
363
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
364 #if 0 /* Leave these out unless we see they are worth having. */
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
365
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
366 DEFUN ("erf", Ferf, Serf, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
367 "Return the mathematical error function of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
368 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
369 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
370 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
371 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
372 IN_FLOAT (d = erf (d), "erf", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
373 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
374 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
375
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
376 DEFUN ("erfc", Ferfc, Serfc, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
377 "Return the complementary error function of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
378 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
379 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
380 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
381 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
382 IN_FLOAT (d = erfc (d), "erfc", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
383 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
384 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
385
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
386 DEFUN ("log-gamma", Flog_gamma, Slog_gamma, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
387 "Return the log gamma of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
388 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
389 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
390 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
391 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
392 IN_FLOAT (d = lgamma (d), "log-gamma", arg);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
393 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
394 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
395
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
396 DEFUN ("cube-root", Fcube_root, Scube_root, 1, 1, 0,
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
397 "Return the cube root of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
398 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
399 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
400 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
401 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
402 #ifdef HAVE_CBRT
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
403 IN_FLOAT (d = cbrt (d), "cube-root", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
404 #else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
405 if (d >= 0.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
406 IN_FLOAT (d = pow (d, 1.0/3.0), "cube-root", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
407 else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
408 IN_FLOAT (d = -pow (-d, 1.0/3.0), "cube-root", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
409 #endif
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
410 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
411 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
412
694
714b8017cc6b entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 683
diff changeset
413 #endif
714b8017cc6b entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 683
diff changeset
414
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
415 DEFUN ("exp", Fexp, Sexp, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
416 "Return the exponential base e of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
417 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
418 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
419 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
420 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
421 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
422 if (d > 709.7827) /* Assume IEEE doubles here */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
423 range_error ("exp", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
424 else if (d < -709.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
425 return make_float (0.0);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
426 else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
427 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
428 IN_FLOAT (d = exp (d), "exp", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
429 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
430 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
431
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
432 DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
13442
7609e8a05862 Fexpt): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 13363
diff changeset
433 "Return the exponential ARG1 ** ARG2.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
434 (arg1, arg2)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
435 register Lisp_Object arg1, arg2;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
436 {
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
437 double f1, f2;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
438
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
439 CHECK_NUMBER_OR_FLOAT (arg1, 0);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
440 CHECK_NUMBER_OR_FLOAT (arg2, 0);
9129
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
441 if (INTEGERP (arg1) /* common lisp spec */
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
442 && INTEGERP (arg2)) /* don't promote, if both are ints */
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
443 { /* this can be improved by pre-calculating */
12537
476296adb950 (Fexpt): Use EMACS_INT for integer calculation.
Karl Heuer <kwzh@gnu.org>
parents: 11859
diff changeset
444 EMACS_INT acc, x, y; /* some binary powers of x then accumulating */
3673
8ab0a7453577 (Fexpt): New local `val' for making integer to return.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
445 Lisp_Object val;
8ab0a7453577 (Fexpt): New local `val' for making integer to return.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
446
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
447 x = XINT (arg1);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
448 y = XINT (arg2);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
449 acc = 1;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
450
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
451 if (y < 0)
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
452 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
453 if (x == 1)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
454 acc = 1;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
455 else if (x == -1)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
456 acc = (y & 1) ? -1 : 1;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
457 else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
458 acc = 0;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
459 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
460 else
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
461 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
462 while (y > 0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
463 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
464 if (y & 1)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
465 acc *= x;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
466 x *= x;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
467 y = (unsigned)y >> 1;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
468 }
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
469 }
9267
1b685d477c10 (FLOAT_TO_INT, FLOAT_TO_INT2, Fexpt, Flogb, Ffloor): Use new accessor macros
Karl Heuer <kwzh@gnu.org>
parents: 9129
diff changeset
470 XSETINT (val, acc);
3673
8ab0a7453577 (Fexpt): New local `val' for making integer to return.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
471 return val;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
472 }
9129
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
473 f1 = FLOATP (arg1) ? XFLOAT (arg1)->data : XINT (arg1);
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
474 f2 = FLOATP (arg2) ? XFLOAT (arg2)->data : XINT (arg2);
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
475 /* Really should check for overflow, too */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
476 if (f1 == 0.0 && f2 == 0.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
477 f1 = 1.0;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
478 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
479 else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor(f2)))
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
480 domain_error2 ("expt", arg1, arg2);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
481 #endif
4529
8dc73bbe1c46 (Fexpt): Use IN_FLOAT2.
Richard M. Stallman <rms@gnu.org>
parents: 4506
diff changeset
482 IN_FLOAT2 (f1 = pow (f1, f2), "expt", arg1, arg2);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
483 return make_float (f1);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
484 }
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
485
1005
70ed307d9047 * floatfns.c (Fexpm1, Flog1p): Function removed; it's not widely
Jim Blandy <jimb@redhat.com>
parents: 694
diff changeset
486 DEFUN ("log", Flog, Slog, 1, 2, 0,
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
487 "Return the natural logarithm of ARG.\n\
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
488 If second optional argument BASE is given, return log ARG using that base.")
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
489 (arg, base)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
490 register Lisp_Object arg, base;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
491 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
492 double d = extract_float (arg);
1005
70ed307d9047 * floatfns.c (Fexpm1, Flog1p): Function removed; it's not widely
Jim Blandy <jimb@redhat.com>
parents: 694
diff changeset
493
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
494 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
495 if (d <= 0.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
496 domain_error2 ("log", arg, base);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
497 #endif
1005
70ed307d9047 * floatfns.c (Fexpm1, Flog1p): Function removed; it's not widely
Jim Blandy <jimb@redhat.com>
parents: 694
diff changeset
498 if (NILP (base))
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
499 IN_FLOAT (d = log (d), "log", arg);
1005
70ed307d9047 * floatfns.c (Fexpm1, Flog1p): Function removed; it's not widely
Jim Blandy <jimb@redhat.com>
parents: 694
diff changeset
500 else
70ed307d9047 * floatfns.c (Fexpm1, Flog1p): Function removed; it's not widely
Jim Blandy <jimb@redhat.com>
parents: 694
diff changeset
501 {
70ed307d9047 * floatfns.c (Fexpm1, Flog1p): Function removed; it's not widely
Jim Blandy <jimb@redhat.com>
parents: 694
diff changeset
502 double b = extract_float (base);
70ed307d9047 * floatfns.c (Fexpm1, Flog1p): Function removed; it's not widely
Jim Blandy <jimb@redhat.com>
parents: 694
diff changeset
503
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
504 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
505 if (b <= 0.0 || b == 1.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
506 domain_error2 ("log", arg, base);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
507 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
508 if (b == 10.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
509 IN_FLOAT2 (d = log10 (d), "log", arg, base);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
510 else
3407
d00aaf536bfd [!FLOAT_CHECK_ERRNO] (IN_FLOAT): New definition.
Richard M. Stallman <rms@gnu.org>
parents: 3094
diff changeset
511 IN_FLOAT2 (d = log (d) / log (b), "log", arg, base);
1005
70ed307d9047 * floatfns.c (Fexpm1, Flog1p): Function removed; it's not widely
Jim Blandy <jimb@redhat.com>
parents: 694
diff changeset
512 }
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
513 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
514 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
515
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
516 DEFUN ("log10", Flog10, Slog10, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
517 "Return the logarithm base 10 of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
518 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
519 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
520 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
521 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
522 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
523 if (d <= 0.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
524 domain_error ("log10", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
525 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
526 IN_FLOAT (d = log10 (d), "log10", arg);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
527 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
528 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
529
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
530 DEFUN ("sqrt", Fsqrt, Ssqrt, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
531 "Return the square root of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
532 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
533 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
534 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
535 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
536 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
537 if (d < 0.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
538 domain_error ("sqrt", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
539 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
540 IN_FLOAT (d = sqrt (d), "sqrt", arg);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
541 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
542 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
543
694
714b8017cc6b entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 683
diff changeset
544 #if 0 /* Not clearly worth adding. */
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
545
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
546 DEFUN ("acosh", Facosh, Sacosh, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
547 "Return the inverse hyperbolic cosine of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
548 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
549 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
550 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
551 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
552 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
553 if (d < 1.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
554 domain_error ("acosh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
555 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
556 #ifdef HAVE_INVERSE_HYPERBOLIC
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
557 IN_FLOAT (d = acosh (d), "acosh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
558 #else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
559 IN_FLOAT (d = log (d + sqrt (d*d - 1.0)), "acosh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
560 #endif
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
561 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
562 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
563
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
564 DEFUN ("asinh", Fasinh, Sasinh, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
565 "Return the inverse hyperbolic sine of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
566 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
567 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
568 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
569 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
570 #ifdef HAVE_INVERSE_HYPERBOLIC
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
571 IN_FLOAT (d = asinh (d), "asinh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
572 #else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
573 IN_FLOAT (d = log (d + sqrt (d*d + 1.0)), "asinh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
574 #endif
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
575 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
576 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
577
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
578 DEFUN ("atanh", Fatanh, Satanh, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
579 "Return the inverse hyperbolic tangent of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
580 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
581 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
582 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
583 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
584 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
585 if (d >= 1.0 || d <= -1.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
586 domain_error ("atanh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
587 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
588 #ifdef HAVE_INVERSE_HYPERBOLIC
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
589 IN_FLOAT (d = atanh (d), "atanh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
590 #else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
591 IN_FLOAT (d = 0.5 * log ((1.0 + d) / (1.0 - d)), "atanh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
592 #endif
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
593 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
594 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
595
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
596 DEFUN ("cosh", Fcosh, Scosh, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
597 "Return the hyperbolic cosine of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
598 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
599 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
600 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
601 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
602 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
603 if (d > 710.0 || d < -710.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
604 range_error ("cosh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
605 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
606 IN_FLOAT (d = cosh (d), "cosh", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
607 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
608 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
609
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
610 DEFUN ("sinh", Fsinh, Ssinh, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
611 "Return the hyperbolic sine of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
612 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
613 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
614 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
615 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
616 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
617 if (d > 710.0 || d < -710.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
618 range_error ("sinh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
619 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
620 IN_FLOAT (d = sinh (d), "sinh", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
621 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
622 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
623
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
624 DEFUN ("tanh", Ftanh, Stanh, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
625 "Return the hyperbolic tangent of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
626 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
627 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
628 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
629 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
630 IN_FLOAT (d = tanh (d), "tanh", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
631 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
632 }
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
633 #endif
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
634
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
635 DEFUN ("abs", Fabs, Sabs, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
636 "Return the absolute value of ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
637 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
638 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
639 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
640 CHECK_NUMBER_OR_FLOAT (arg, 0);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
641
9129
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
642 if (FLOATP (arg))
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
643 IN_FLOAT (arg = make_float (fabs (XFLOAT (arg)->data)), "abs", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
644 else if (XINT (arg) < 0)
9365
0b431684f97b (Fabs): Don't use XFASTINT when negative.
Karl Heuer <kwzh@gnu.org>
parents: 9267
diff changeset
645 XSETINT (arg, - XINT (arg));
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
646
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
647 return arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
648 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
649
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
650 DEFUN ("float", Ffloat, Sfloat, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
651 "Return the floating point number equal to ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
652 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
653 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
654 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
655 CHECK_NUMBER_OR_FLOAT (arg, 0);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
656
9129
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
657 if (INTEGERP (arg))
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
658 return make_float ((double) XINT (arg));
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
659 else /* give 'em the same float back */
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
660 return arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
661 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
662
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
663 DEFUN ("logb", Flogb, Slogb, 1, 1, 0,
4590
e8bd41ac77be (Flogb): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4529
diff changeset
664 "Returns largest integer <= the base 2 log of the magnitude of ARG.\n\
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
665 This is the same as the exponent of a float.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
666 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
667 Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
668 {
2119
4077ef8ad483 * floatfns.c (Flogb): Undo the change of Feb 22.
Jim Blandy <jimb@redhat.com>
parents: 2094
diff changeset
669 Lisp_Object val;
11265
b2291296ec87 (Flogb): Use EMACS_INT for `value'.
Richard M. Stallman <rms@gnu.org>
parents: 9365
diff changeset
670 EMACS_INT value;
2129
6741f5f8ed54 (Flogb): Fix arg names. Don't confuse Lisp_Object with integer.
Richard M. Stallman <rms@gnu.org>
parents: 2128
diff changeset
671 double f = extract_float (arg);
2119
4077ef8ad483 * floatfns.c (Flogb): Undo the change of Feb 22.
Jim Blandy <jimb@redhat.com>
parents: 2094
diff changeset
672
6359
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
673 if (f == 0.0)
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
674 value = -(VALMASK >> 1);
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
675 else
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
676 {
4501
9352d7d021c2 * config.h.in (HAVE_LOGB, HAVE_FREXP): Add #undefs for the
Jim Blandy <jimb@redhat.com>
parents: 3673
diff changeset
677 #ifdef HAVE_LOGB
6359
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
678 IN_FLOAT (value = logb (f), "logb", arg);
4501
9352d7d021c2 * config.h.in (HAVE_LOGB, HAVE_FREXP): Add #undefs for the
Jim Blandy <jimb@redhat.com>
parents: 3673
diff changeset
679 #else
9352d7d021c2 * config.h.in (HAVE_LOGB, HAVE_FREXP): Add #undefs for the
Jim Blandy <jimb@redhat.com>
parents: 3673
diff changeset
680 #ifdef HAVE_FREXP
11859
8d57babf4b36 (Flogb): frexp needs a pointer to int, not EMACS_INT.
Karl Heuer <kwzh@gnu.org>
parents: 11265
diff changeset
681 int ivalue;
8d57babf4b36 (Flogb): frexp needs a pointer to int, not EMACS_INT.
Karl Heuer <kwzh@gnu.org>
parents: 11265
diff changeset
682 IN_FLOAT (frexp (f, &ivalue), "logb", arg);
8d57babf4b36 (Flogb): frexp needs a pointer to int, not EMACS_INT.
Karl Heuer <kwzh@gnu.org>
parents: 11265
diff changeset
683 value = ivalue - 1;
2205
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
684 #else
6359
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
685 int i;
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
686 double d;
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
687 if (f < 0.0)
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
688 f = -f;
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
689 value = -1;
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
690 while (f < 0.5)
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
691 {
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
692 for (i = 1, d = 0.5; d * d >= f; i += i)
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
693 d *= d;
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
694 f /= d;
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
695 value -= i;
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
696 }
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
697 while (f >= 1.0)
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
698 {
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
699 for (i = 1, d = 2.0; d * d <= f; i += i)
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
700 d *= d;
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
701 f /= d;
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
702 value += i;
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
703 }
4501
9352d7d021c2 * config.h.in (HAVE_LOGB, HAVE_FREXP): Add #undefs for the
Jim Blandy <jimb@redhat.com>
parents: 3673
diff changeset
704 #endif
2205
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
705 #endif
6359
800c035273e9 (Flogb): Check for 0.0. Emulate logb if needed.
Karl Heuer <kwzh@gnu.org>
parents: 6314
diff changeset
706 }
9267
1b685d477c10 (FLOAT_TO_INT, FLOAT_TO_INT2, Fexpt, Flogb, Ffloor): Use new accessor macros
Karl Heuer <kwzh@gnu.org>
parents: 9129
diff changeset
707 XSETINT (val, value);
2119
4077ef8ad483 * floatfns.c (Flogb): Undo the change of Feb 22.
Jim Blandy <jimb@redhat.com>
parents: 2094
diff changeset
708 return val;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
709 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
710
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
711 /* the rounding functions */
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
712
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
713 DEFUN ("ceiling", Fceiling, Sceiling, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
714 "Return the smallest integer no less than ARG. (Round toward +inf.)")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
715 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
716 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
717 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
718 CHECK_NUMBER_OR_FLOAT (arg, 0);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
719
9129
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
720 if (FLOATP (arg))
6375
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
721 {
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
722 double d;
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
723
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
724 IN_FLOAT (d = ceil (XFLOAT (arg)->data), "ceiling", arg);
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
725 FLOAT_TO_INT (d, arg, "ceiling", arg);
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
726 }
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
727
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
728 return arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
729 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
730
4506
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
731 #endif /* LISP_FLOAT_TYPE */
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
732
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
733
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
734 DEFUN ("floor", Ffloor, Sfloor, 1, 2, 0,
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
735 "Return the largest integer no greater than ARG. (Round towards -inf.)\n\
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
736 With optional DIVISOR, return the largest integer no greater than ARG/DIVISOR.")
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
737 (arg, divisor)
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
738 register Lisp_Object arg, divisor;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
739 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
740 CHECK_NUMBER_OR_FLOAT (arg, 0);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
741
4506
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
742 if (! NILP (divisor))
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
743 {
12537
476296adb950 (Fexpt): Use EMACS_INT for integer calculation.
Karl Heuer <kwzh@gnu.org>
parents: 11859
diff changeset
744 EMACS_INT i1, i2;
4506
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
745
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
746 CHECK_NUMBER_OR_FLOAT (divisor, 1);
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
747
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
748 #ifdef LISP_FLOAT_TYPE
9129
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
749 if (FLOATP (arg) || FLOATP (divisor))
4506
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
750 {
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
751 double f1, f2;
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
752
9129
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
753 f1 = FLOATP (arg) ? XFLOAT (arg)->data : XINT (arg);
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
754 f2 = (FLOATP (divisor) ? XFLOAT (divisor)->data : XINT (divisor));
4506
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
755 if (f2 == 0)
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
756 Fsignal (Qarith_error, Qnil);
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
757
6375
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
758 IN_FLOAT2 (f1 = floor (f1 / f2), "floor", arg, divisor);
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
759 FLOAT_TO_INT2 (f1, arg, "floor", arg, divisor);
4506
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
760 return arg;
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
761 }
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
762 #endif
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
763
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
764 i1 = XINT (arg);
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
765 i2 = XINT (divisor);
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
766
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
767 if (i2 == 0)
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
768 Fsignal (Qarith_error, Qnil);
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
769
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
770 /* With C's /, the result is implementation-defined if either operand
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
771 is negative, so use only nonnegative operands. */
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
772 i1 = (i2 < 0
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
773 ? (i1 <= 0 ? -i1 / -i2 : -1 - ((i1 - 1) / -i2))
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
774 : (i1 < 0 ? -1 - ((-1 - i1) / i2) : i1 / i2));
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
775
9267
1b685d477c10 (FLOAT_TO_INT, FLOAT_TO_INT2, Fexpt, Flogb, Ffloor): Use new accessor macros
Karl Heuer <kwzh@gnu.org>
parents: 9129
diff changeset
776 XSETINT (arg, i1);
4506
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
777 return arg;
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
778 }
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
779
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
780 #ifdef LISP_FLOAT_TYPE
9129
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
781 if (FLOATP (arg))
6375
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
782 {
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
783 double d;
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
784 IN_FLOAT (d = floor (XFLOAT (arg)->data), "floor", arg);
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
785 FLOAT_TO_INT (d, arg, "floor", arg);
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
786 }
4506
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
787 #endif
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
788
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
789 return arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
790 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
791
4506
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
792 #ifdef LISP_FLOAT_TYPE
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
793
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
794 DEFUN ("round", Fround, Sround, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
795 "Return the nearest integer to ARG.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
796 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
797 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
798 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
799 CHECK_NUMBER_OR_FLOAT (arg, 0);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
800
9129
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
801 if (FLOATP (arg))
6375
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
802 {
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
803 double d;
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
804
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
805 /* Screw the prevailing rounding mode. */
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
806 IN_FLOAT (d = rint (XFLOAT (arg)->data), "round", arg);
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
807 FLOAT_TO_INT (d, arg, "round", arg);
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
808 }
1918
699ae3079c09 * floatfns.c (Flogb): Always implement this by calling Flog, even
Jim Blandy <jimb@redhat.com>
parents: 1715
diff changeset
809
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
810 return arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
811 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
812
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
813 DEFUN ("truncate", Ftruncate, Struncate, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
814 "Truncate a floating point number to an int.\n\
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
815 Rounds the value toward zero.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
816 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
817 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
818 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
819 CHECK_NUMBER_OR_FLOAT (arg, 0);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
820
9129
b2d1d925d5cc (extract_float, Fexpt, Fabs, Ffloat, Fceiling, Ffloor, Fround, Ftruncate): Use
Karl Heuer <kwzh@gnu.org>
parents: 8825
diff changeset
821 if (FLOATP (arg))
6375
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
822 {
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
823 double d;
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
824
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
825 d = XFLOAT (arg)->data;
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
826 FLOAT_TO_INT (d, arg, "truncate", arg);
212dcd2c06e4 (FLOAT_TO_INT, FLOAT_TO_INT2, range_error2): New macros.
Karl Heuer <kwzh@gnu.org>
parents: 6359
diff changeset
827 }
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
828
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
829 return arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
830 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
831
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
832 /* It's not clear these are worth adding. */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
833
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
834 DEFUN ("fceiling", Ffceiling, Sfceiling, 1, 1, 0,
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
835 "Return the smallest integer no less than ARG, as a float.\n\
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
836 \(Round toward +inf.\)")
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
837 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
838 register Lisp_Object arg;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
839 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
840 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
841 IN_FLOAT (d = ceil (d), "fceiling", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
842 return make_float (d);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
843 }
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
844
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
845 DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0,
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
846 "Return the largest integer no greater than ARG, as a float.\n\
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
847 \(Round towards -inf.\)")
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
848 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
849 register Lisp_Object arg;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
850 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
851 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
852 IN_FLOAT (d = floor (d), "ffloor", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
853 return make_float (d);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
854 }
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
855
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
856 DEFUN ("fround", Ffround, Sfround, 1, 1, 0,
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
857 "Return the nearest integer to ARG, as a float.")
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
858 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
859 register Lisp_Object arg;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
860 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
861 double d = extract_float (arg);
5595
63bc8a14a073 (Fffloor, Ffceil, Ffround, Fftruncate): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 5495
diff changeset
862 IN_FLOAT (d = rint (d), "fround", arg);
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
863 return make_float (d);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
864 }
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
865
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
866 DEFUN ("ftruncate", Fftruncate, Sftruncate, 1, 1, 0,
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
867 "Truncate a floating point number to an integral float value.\n\
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
868 Rounds the value toward zero.")
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
869 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
870 register Lisp_Object arg;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
871 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
872 double d = extract_float (arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
873 if (d >= 0.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
874 IN_FLOAT (d = floor (d), "ftruncate", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
875 else
5495
87f9165f5b14 [MSDOS]: Don't define HAVE_MATHERR.
Richard M. Stallman <rms@gnu.org>
parents: 4881
diff changeset
876 IN_FLOAT (d = ceil (d), "ftruncate", arg);
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
877 return make_float (d);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
878 }
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
879
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
880 #ifdef FLOAT_CATCH_SIGILL
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
881 static SIGTYPE
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
882 float_error (signo)
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
883 int signo;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
884 {
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
885 if (! in_float)
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
886 fatal_error_signal (signo);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
887
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
888 #ifdef BSD
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
889 #ifdef BSD4_1
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
890 sigrelse (SIGILL);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
891 #else /* not BSD4_1 */
638
40b255f55df3 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 624
diff changeset
892 sigsetmask (SIGEMPTYMASK);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
893 #endif /* not BSD4_1 */
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
894 #else
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
895 /* Must reestablish handler each time it is called. */
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
896 signal (SIGILL, float_error);
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
897 #endif /* BSD */
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
898
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
899 in_float = 0;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
900
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
901 Fsignal (Qarith_error, Fcons (float_error_arg, Qnil));
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
902 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
903
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
904 /* Another idea was to replace the library function `infnan'
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
905 where SIGILL is signaled. */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
906
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
907 #endif /* FLOAT_CATCH_SIGILL */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
908
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
909 #ifdef HAVE_MATHERR
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
910 int
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
911 matherr (x)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
912 struct exception *x;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
913 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
914 Lisp_Object args;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
915 if (! in_float)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
916 /* Not called from emacs-lisp float routines; do the default thing. */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
917 return 0;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
918 if (!strcmp (x->name, "pow"))
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
919 x->name = "expt";
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
920
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
921 args
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
922 = Fcons (build_string (x->name),
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
923 Fcons (make_float (x->arg1),
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
924 ((!strcmp (x->name, "log") || !strcmp (x->name, "pow"))
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
925 ? Fcons (make_float (x->arg2), Qnil)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
926 : Qnil)));
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
927 switch (x->type)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
928 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
929 case DOMAIN: Fsignal (Qdomain_error, args); break;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
930 case SING: Fsignal (Qsingularity_error, args); break;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
931 case OVERFLOW: Fsignal (Qoverflow_error, args); break;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
932 case UNDERFLOW: Fsignal (Qunderflow_error, args); break;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
933 default: Fsignal (Qarith_error, args); break;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
934 }
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
935 return (1); /* don't set errno or print a message */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
936 }
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
937 #endif /* HAVE_MATHERR */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
938
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
939 init_floatfns ()
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
940 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
941 #ifdef FLOAT_CATCH_SIGILL
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
942 signal (SIGILL, float_error);
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
943 #endif
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
944 in_float = 0;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
945 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
946
4506
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
947 #else /* not LISP_FLOAT_TYPE */
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
948
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
949 init_floatfns ()
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
950 {}
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
951
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
952 #endif /* not LISP_FLOAT_TYPE */
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
953
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
954 syms_of_floatfns ()
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
955 {
4506
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
956 #ifdef LISP_FLOAT_TYPE
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
957 defsubr (&Sacos);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
958 defsubr (&Sasin);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
959 defsubr (&Satan);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
960 defsubr (&Scos);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
961 defsubr (&Ssin);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
962 defsubr (&Stan);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
963 #if 0
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
964 defsubr (&Sacosh);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
965 defsubr (&Sasinh);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
966 defsubr (&Satanh);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
967 defsubr (&Scosh);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
968 defsubr (&Ssinh);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
969 defsubr (&Stanh);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
970 defsubr (&Sbessel_y0);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
971 defsubr (&Sbessel_y1);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
972 defsubr (&Sbessel_yn);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
973 defsubr (&Sbessel_j0);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
974 defsubr (&Sbessel_j1);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
975 defsubr (&Sbessel_jn);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
976 defsubr (&Serf);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
977 defsubr (&Serfc);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
978 defsubr (&Slog_gamma);
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
979 defsubr (&Scube_root);
5595
63bc8a14a073 (Fffloor, Ffceil, Ffround, Fftruncate): New functions.
Richard M. Stallman <rms@gnu.org>
parents: 5495
diff changeset
980 #endif
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
981 defsubr (&Sfceiling);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
982 defsubr (&Sffloor);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
983 defsubr (&Sfround);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
984 defsubr (&Sftruncate);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
985 defsubr (&Sexp);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
986 defsubr (&Sexpt);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
987 defsubr (&Slog);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
988 defsubr (&Slog10);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
989 defsubr (&Ssqrt);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
990
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
991 defsubr (&Sabs);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
992 defsubr (&Sfloat);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
993 defsubr (&Slogb);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
994 defsubr (&Sceiling);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
995 defsubr (&Sround);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
996 defsubr (&Struncate);
4506
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
997 #endif /* LISP_FLOAT_TYPE */
6131dad14f6f (Ffloor): Optional second operand specifies divisor, as in Common Lisp.
Paul Eggert <eggert@twinsun.com>
parents: 4501
diff changeset
998 defsubr (&Sfloor);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
999 }