annotate src/floatfns.c @ 3426:7ecee84713e6

(do-install): Partially rewrite using `if'.
author Richard M. Stallman <rms@gnu.org>
date Wed, 02 Jun 1993 05:16:03 +0000
parents d00aaf536bfd
children 1950b2238ecc
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.
2961
e94a593c3952 Updated copyright years.
Jim Blandy <jimb@redhat.com>
parents: 2205
diff changeset
2 Copyright (C) 1988, 1993 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
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
19
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
20
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
21 /* 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
22 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
23 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
24
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
25 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
26 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
27 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
28 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
29
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
30 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
31 (This should happen automatically.)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
32
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
33 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
34 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
35
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
36 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
37 (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
38
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
39 Define FLOAT_CHECK_DOMAIN if the float library doesn't handle errors by
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
40 either setting errno, or signalling SIGFPE/SIGILL. Otherwise, domain and
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
41 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
42 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
43 a domain error occurs.)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
44 */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
45
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
46 #include <signal.h>
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
47
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
48 #include "config.h"
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
49 #include "lisp.h"
638
40b255f55df3 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 624
diff changeset
50 #include "syssignal.h"
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
51
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
52 Lisp_Object Qarith_error;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
53
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
54 #ifdef LISP_FLOAT_TYPE
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
55
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
56 #include <math.h>
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
57
3094
4b3770f84aa7 (logb): Don't declare if hpux.
Richard M. Stallman <rms@gnu.org>
parents: 3027
diff changeset
58 #ifndef hpux
2205
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
59 /* These declarations are omitted on some systems, like Ultrix. */
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
60 extern double logb ();
3094
4b3770f84aa7 (logb): Don't declare if hpux.
Richard M. Stallman <rms@gnu.org>
parents: 3027
diff changeset
61 #endif
2205
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
62
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
63 #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
64 /* 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
65 # ifndef HAVE_MATHERR
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
66 # define HAVE_MATHERR
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
67 # endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
68 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
69
3027
7ed290bef028 Fix typo in last change.
Richard M. Stallman <rms@gnu.org>
parents: 3025
diff changeset
70 #ifdef NO_MATHERR
3025
d09f68ccd145 [NO_MATHERR]: Undef HAVE_MATHERR.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
71 #undef HAVE_MATHERR
d09f68ccd145 [NO_MATHERR]: Undef HAVE_MATHERR.
Richard M. Stallman <rms@gnu.org>
parents: 2961
diff changeset
72 #endif
d09f68ccd145 [NO_MATHERR]: Undef HAVE_MATHERR.
Richard M. Stallman <rms@gnu.org>
parents: 2961
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 #ifdef HAVE_MATHERR
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
75 # ifdef FLOAT_CHECK_ERRNO
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
76 # undef FLOAT_CHECK_ERRNO
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
77 # endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
78 # ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
79 # undef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
80 # endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
81 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
82
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
83 #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
84 #define FLOAT_CHECK_ERRNO
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
85 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
86
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
87 #ifdef FLOAT_CHECK_ERRNO
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
88 # include <errno.h>
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
89
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
90 extern int errno;
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
91 #endif
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
92
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
93 /* Avoid traps on VMS from sinh and cosh.
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
94 All the other functions set errno instead. */
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
95
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
96 #ifdef VMS
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
97 #undef cosh
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
98 #undef sinh
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
99 #define cosh(x) ((exp(x)+exp(-x))*0.5)
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
100 #define sinh(x) ((exp(x)-exp(-x))*0.5)
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
101 #endif /* VMS */
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
102
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
103 #ifndef HAVE_RINT
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
104 #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
105 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
106
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
107 static SIGTYPE float_error ();
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
108
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
109 /* Nonzero while executing in floating point.
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
110 This tells float_error what to do. */
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
111
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
112 static int in_float;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
113
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
114 /* 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
115 here is the actual argument value to use in the error message. */
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
116
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
117 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
118
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
119 static char *float_error_fn_name;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
120
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
121 /* Evaluate the floating point expression D, recording NUM
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
122 as the original argument for error messages.
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
123 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
124 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
125
699ae3079c09 * floatfns.c (Flogb): Always implement this by calling Flog, even
Jim Blandy <jimb@redhat.com>
parents: 1715
diff changeset
126 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
127 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
128 check properly. */
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
129
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
130 #ifdef FLOAT_CHECK_ERRNO
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
131 #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
132 do { \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
133 float_error_arg = num; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
134 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
135 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
136 switch (errno) { \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
137 case 0: break; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
138 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
139 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
140 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
141 } \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
142 } while (0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
143 #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
144 do { \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
145 float_error_arg = num; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
146 float_error_arg2 = num2; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
147 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
148 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
149 switch (errno) { \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
150 case 0: break; \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
151 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
152 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
153 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
154 } \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
155 } while (0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
156 #else
3407
d00aaf536bfd [!FLOAT_CHECK_ERRNO] (IN_FLOAT): New definition.
Richard M. Stallman <rms@gnu.org>
parents: 3094
diff changeset
157 #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
158 #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
159 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
160
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
161 #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
162 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
163 #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
164 Fsignal (Qrange_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
165 #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
166 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
167 #define domain_error2(op,a1,a2) \
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
168 Fsignal (Qdomain_error, Fcons (build_string ((op)), Fcons ((a1), Fcons ((a2), Qnil))))
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
169
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
170 /* Extract a Lisp number as a `double', or signal an error. */
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
171
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
172 double
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
173 extract_float (num)
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
174 Lisp_Object num;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
175 {
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
176 CHECK_NUMBER_OR_FLOAT (num, 0);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
177
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
178 if (XTYPE (num) == Lisp_Float)
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
179 return XFLOAT (num)->data;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
180 return (double) XINT (num);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
181 }
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
182
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
183 /* Trig functions. */
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
184
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
185 DEFUN ("acos", Facos, Sacos, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
186 "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
187 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
188 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
189 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
190 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
191 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
192 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
193 domain_error ("acos", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
194 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
195 IN_FLOAT (d = acos (d), "acos", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
196 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
197 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
198
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
199 DEFUN ("asin", Fasin, Sasin, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
200 "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
201 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
202 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
203 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
204 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
205 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
206 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
207 domain_error ("asin", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
208 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
209 IN_FLOAT (d = asin (d), "asin", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
210 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
211 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
212
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
213 DEFUN ("atan", Fatan, Satan, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
214 "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
215 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
216 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
217 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
218 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
219 IN_FLOAT (d = atan (d), "atan", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
220 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
221 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
222
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
223 DEFUN ("cos", Fcos, Scos, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
224 "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
225 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
226 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
227 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
228 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
229 IN_FLOAT (d = cos (d), "cos", arg);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
230 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
231 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
232
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
233 DEFUN ("sin", Fsin, Ssin, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
234 "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
235 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
236 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
237 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
238 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
239 IN_FLOAT (d = sin (d), "sin", arg);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
240 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
241 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
242
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
243 DEFUN ("tan", Ftan, Stan, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
244 "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
245 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
246 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
247 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
248 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
249 double c = cos (d);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
250 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
251 if (c == 0.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
252 domain_error ("tan", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
253 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
254 IN_FLOAT (d = sin (d) / c, "tan", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
255 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
256 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
257
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
258 #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
259
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
260 DEFUN ("bessel-j0", Fbessel_j0, Sbessel_j0, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
261 "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
262 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
263 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
264 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
265 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
266 IN_FLOAT (d = j0 (d), "bessel-j0", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
267 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
268 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
269
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
270 DEFUN ("bessel-j1", Fbessel_j1, Sbessel_j1, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
271 "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
272 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
273 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
274 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
275 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
276 IN_FLOAT (d = j1 (d), "bessel-j1", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
277 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
278 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
279
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
280 DEFUN ("bessel-jn", Fbessel_jn, Sbessel_jn, 2, 2, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
281 "Return the order N bessel function output jn of ARG.\n\
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
282 The first arg (the order) is truncated to an integer.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
283 (arg1, arg2)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
284 register Lisp_Object arg1, arg2;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
285 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
286 int i1 = extract_float (arg1);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
287 double f2 = extract_float (arg2);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
288
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
289 IN_FLOAT (f2 = jn (i1, f2), "bessel-jn", arg1);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
290 return make_float (f2);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
291 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
292
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
293 DEFUN ("bessel-y0", Fbessel_y0, Sbessel_y0, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
294 "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
295 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
296 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
297 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
298 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
299 IN_FLOAT (d = y0 (d), "bessel-y0", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
300 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
301 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
302
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
303 DEFUN ("bessel-y1", Fbessel_y1, Sbessel_y1, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
304 "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
305 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
306 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
307 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
308 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
309 IN_FLOAT (d = y1 (d), "bessel-y0", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
310 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
311 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
312
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
313 DEFUN ("bessel-yn", Fbessel_yn, Sbessel_yn, 2, 2, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
314 "Return the order N bessel function output yn of ARG.\n\
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
315 The first arg (the order) is truncated to an integer.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
316 (arg1, arg2)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
317 register Lisp_Object arg1, arg2;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
318 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
319 int i1 = extract_float (arg1);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
320 double f2 = extract_float (arg2);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
321
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
322 IN_FLOAT (f2 = yn (i1, f2), "bessel-yn", arg1);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
323 return make_float (f2);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
324 }
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
325
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
326 #endif
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
327
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
328 #if 0 /* Leave these out unless we see they are worth having. */
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
329
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
330 DEFUN ("erf", Ferf, Serf, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
331 "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
332 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
333 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
334 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
335 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
336 IN_FLOAT (d = erf (d), "erf", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
337 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
338 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
339
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
340 DEFUN ("erfc", Ferfc, Serfc, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
341 "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
342 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
343 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
344 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
345 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
346 IN_FLOAT (d = erfc (d), "erfc", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
347 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
348 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
349
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
350 DEFUN ("log-gamma", Flog_gamma, Slog_gamma, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
351 "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
352 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
353 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
354 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
355 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
356 IN_FLOAT (d = lgamma (d), "log-gamma", arg);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
357 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
358 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
359
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
360 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
361 "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
362 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
363 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
364 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
365 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
366 #ifdef HAVE_CBRT
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
367 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
368 #else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
369 if (d >= 0.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
370 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
371 else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
372 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
373 #endif
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
374 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
375 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
376
694
714b8017cc6b entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 683
diff changeset
377 #endif
714b8017cc6b entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 683
diff changeset
378
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
379 DEFUN ("exp", Fexp, Sexp, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
380 "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
381 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
382 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
383 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
384 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
385 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
386 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
387 range_error ("exp", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
388 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
389 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
390 else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
391 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
392 IN_FLOAT (d = exp (d), "exp", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
393 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
394 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
395
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
396 DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
397 "Return the exponential X ** Y.")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
398 (arg1, arg2)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
399 register Lisp_Object arg1, arg2;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
400 {
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
401 double f1, f2;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
402
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
403 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
404 CHECK_NUMBER_OR_FLOAT (arg2, 0);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
405 if ((XTYPE (arg1) == Lisp_Int) && /* common lisp spec */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
406 (XTYPE (arg2) == Lisp_Int)) /* don't promote, if both are ints */
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
407 { /* this can be improved by pre-calculating */
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
408 int acc, x, y; /* some binary powers of x then acumulating */
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
409 /* these, therby saving some time. -wsr */
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
410 x = XINT (arg1);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
411 y = XINT (arg2);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
412 acc = 1;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
413
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
414 if (y < 0)
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
415 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
416 if (x == 1)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
417 acc = 1;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
418 else if (x == -1)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
419 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
420 else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
421 acc = 0;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
422 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
423 else
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
424 {
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
425 for (; y > 0; y--)
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
426 while (y > 0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
427 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
428 if (y & 1)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
429 acc *= x;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
430 x *= x;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
431 y = (unsigned)y >> 1;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
432 }
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
433 }
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
434 XSET (x, Lisp_Int, acc);
1512
bef6b6903528 * floatfns.c (Flog): Don't forget to declare the BASE argument a
Jim Blandy <jimb@redhat.com>
parents: 1005
diff changeset
435 return x;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
436 }
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
437 f1 = (XTYPE (arg1) == Lisp_Float) ? XFLOAT (arg1)->data : XINT (arg1);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
438 f2 = (XTYPE (arg2) == Lisp_Float) ? XFLOAT (arg2)->data : XINT (arg2);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
439 /* 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
440 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
441 f1 = 1.0;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
442 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
443 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
444 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
445 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
446 IN_FLOAT (f1 = pow (f1, f2), "expt", arg1);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
447 return make_float (f1);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
448 }
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
449
1005
70ed307d9047 * floatfns.c (Fexpm1, Flog1p): Function removed; it's not widely
Jim Blandy <jimb@redhat.com>
parents: 694
diff changeset
450 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
451 "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
452 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
453 (arg, base)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
454 register Lisp_Object arg, base;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
455 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
456 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
457
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
458 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
459 if (d <= 0.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
460 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
461 #endif
1005
70ed307d9047 * floatfns.c (Fexpm1, Flog1p): Function removed; it's not widely
Jim Blandy <jimb@redhat.com>
parents: 694
diff changeset
462 if (NILP (base))
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
463 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
464 else
70ed307d9047 * floatfns.c (Fexpm1, Flog1p): Function removed; it's not widely
Jim Blandy <jimb@redhat.com>
parents: 694
diff changeset
465 {
70ed307d9047 * floatfns.c (Fexpm1, Flog1p): Function removed; it's not widely
Jim Blandy <jimb@redhat.com>
parents: 694
diff changeset
466 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
467
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
468 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
469 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
470 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
471 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
472 if (b == 10.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
473 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
474 else
3407
d00aaf536bfd [!FLOAT_CHECK_ERRNO] (IN_FLOAT): New definition.
Richard M. Stallman <rms@gnu.org>
parents: 3094
diff changeset
475 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
476 }
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
477 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
478 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
479
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
480 DEFUN ("log10", Flog10, Slog10, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
481 "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
482 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
483 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
484 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
485 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
486 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
487 if (d <= 0.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
488 domain_error ("log10", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
489 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
490 IN_FLOAT (d = log10 (d), "log10", arg);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
491 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
492 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
493
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
494 DEFUN ("sqrt", Fsqrt, Ssqrt, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
495 "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
496 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
497 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
498 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
499 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
500 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
501 if (d < 0.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
502 domain_error ("sqrt", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
503 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
504 IN_FLOAT (d = sqrt (d), "sqrt", arg);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
505 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
506 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
507
694
714b8017cc6b entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 683
diff changeset
508 #if 0 /* Not clearly worth adding. */
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
509
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
510 DEFUN ("acosh", Facosh, Sacosh, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
511 "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
512 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
513 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
514 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
515 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
516 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
517 if (d < 1.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
518 domain_error ("acosh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
519 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
520 #ifdef HAVE_INVERSE_HYPERBOLIC
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
521 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
522 #else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
523 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
524 #endif
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
525 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
526 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
527
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
528 DEFUN ("asinh", Fasinh, Sasinh, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
529 "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
530 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
531 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
532 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
533 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
534 #ifdef HAVE_INVERSE_HYPERBOLIC
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
535 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
536 #else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
537 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
538 #endif
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
539 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
540 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
541
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
542 DEFUN ("atanh", Fatanh, Satanh, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
543 "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
544 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
545 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
546 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
547 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
548 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
549 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
550 domain_error ("atanh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
551 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
552 #ifdef HAVE_INVERSE_HYPERBOLIC
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
553 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
554 #else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
555 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
556 #endif
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
557 return make_float (d);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
558 }
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
559
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
560 DEFUN ("cosh", Fcosh, Scosh, 1, 1, 0,
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
561 "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
562 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
563 register Lisp_Object arg;
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
564 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
565 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
566 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
567 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
568 range_error ("cosh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
569 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
570 IN_FLOAT (d = cosh (d), "cosh", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
571 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
572 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
573
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
574 DEFUN ("sinh", Fsinh, Ssinh, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
575 "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
576 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
577 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
578 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
579 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
580 #ifdef FLOAT_CHECK_DOMAIN
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
581 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
582 range_error ("sinh", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
583 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
584 IN_FLOAT (d = sinh (d), "sinh", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
585 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
586 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
587
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
588 DEFUN ("tanh", Ftanh, Stanh, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
589 "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
590 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
591 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
592 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
593 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
594 IN_FLOAT (d = tanh (d), "tanh", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
595 return make_float (d);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
596 }
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
597 #endif
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
598
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
599 DEFUN ("abs", Fabs, Sabs, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
600 "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
601 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
602 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
603 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
604 CHECK_NUMBER_OR_FLOAT (arg, 0);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
605
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
606 if (XTYPE (arg) == Lisp_Float)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
607 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
608 else if (XINT (arg) < 0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
609 XSETINT (arg, - XFASTINT (arg));
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
610
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
611 return arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
612 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
613
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
614 DEFUN ("float", Ffloat, Sfloat, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
615 "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
616 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
617 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
618 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
619 CHECK_NUMBER_OR_FLOAT (arg, 0);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
620
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
621 if (XTYPE (arg) == Lisp_Int)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
622 return make_float ((double) XINT (arg));
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
623 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
624 return arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
625 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
626
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
627 DEFUN ("logb", Flogb, Slogb, 1, 1, 0,
2119
4077ef8ad483 * floatfns.c (Flogb): Undo the change of Feb 22.
Jim Blandy <jimb@redhat.com>
parents: 2094
diff changeset
628 "Returns the integer not greater than the base 2 log of the magnitude of ARG.\n\
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
629 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
630 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
631 Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
632 {
2119
4077ef8ad483 * floatfns.c (Flogb): Undo the change of Feb 22.
Jim Blandy <jimb@redhat.com>
parents: 2094
diff changeset
633 Lisp_Object val;
2129
6741f5f8ed54 (Flogb): Fix arg names. Don't confuse Lisp_Object with integer.
Richard M. Stallman <rms@gnu.org>
parents: 2128
diff changeset
634 int value;
6741f5f8ed54 (Flogb): Fix arg names. Don't confuse Lisp_Object with integer.
Richard M. Stallman <rms@gnu.org>
parents: 2128
diff changeset
635 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
636
2205
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
637 #ifdef USG
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
638 {
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
639 int exp;
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
640
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
641 IN_FLOAT (frexp (f, &exp), "logb", arg);
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
642 XSET (val, Lisp_Int, exp-1);
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
643 }
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
644 #else
2129
6741f5f8ed54 (Flogb): Fix arg names. Don't confuse Lisp_Object with integer.
Richard M. Stallman <rms@gnu.org>
parents: 2128
diff changeset
645 IN_FLOAT (value = logb (f), "logb", arg);
6741f5f8ed54 (Flogb): Fix arg names. Don't confuse Lisp_Object with integer.
Richard M. Stallman <rms@gnu.org>
parents: 2128
diff changeset
646 XSET (val, Lisp_Int, value);
2205
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
647 #endif
c021f53fe7e5 * floatfns.c (logb): Add extern declaration for this.
Jim Blandy <jimb@redhat.com>
parents: 2129
diff changeset
648
2119
4077ef8ad483 * floatfns.c (Flogb): Undo the change of Feb 22.
Jim Blandy <jimb@redhat.com>
parents: 2094
diff changeset
649 return val;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
650 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
651
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
652 /* the rounding functions */
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
653
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
654 DEFUN ("ceiling", Fceiling, Sceiling, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
655 "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
656 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
657 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
658 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
659 CHECK_NUMBER_OR_FLOAT (arg, 0);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
660
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
661 if (XTYPE (arg) == Lisp_Float)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
662 IN_FLOAT (XSET (arg, Lisp_Int, ceil (XFLOAT (arg)->data)), "celing", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
663
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
664 return arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
665 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
666
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
667 DEFUN ("floor", Ffloor, Sfloor, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
668 "Return the largest integer no greater than ARG. (Round towards -inf.)")
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
669 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
670 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
671 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
672 CHECK_NUMBER_OR_FLOAT (arg, 0);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
673
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
674 if (XTYPE (arg) == Lisp_Float)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
675 IN_FLOAT (XSET (arg, Lisp_Int, floor (XFLOAT (arg)->data)), "floor", arg);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
676
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
677 return arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
678 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
679
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
680 DEFUN ("round", Fround, Sround, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
681 "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
682 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
683 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
684 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
685 CHECK_NUMBER_OR_FLOAT (arg, 0);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
686
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
687 if (XTYPE (arg) == Lisp_Float)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
688 /* Screw the prevailing rounding mode. */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
689 IN_FLOAT (XSET (arg, Lisp_Int, rint (XFLOAT (arg)->data)), "round", arg);
1918
699ae3079c09 * floatfns.c (Flogb): Always implement this by calling Flog, even
Jim Blandy <jimb@redhat.com>
parents: 1715
diff changeset
690
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
691 return arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
692 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
693
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
694 DEFUN ("truncate", Ftruncate, Struncate, 1, 1, 0,
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
695 "Truncate a floating point number to an int.\n\
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
696 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
697 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
698 register Lisp_Object arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
699 {
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
700 CHECK_NUMBER_OR_FLOAT (arg, 0);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
701
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
702 if (XTYPE (arg) == Lisp_Float)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
703 XSET (arg, Lisp_Int, (int) XFLOAT (arg)->data);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
704
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
705 return arg;
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
706 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
707
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
708 #if 0
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
709 /* 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
710
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
711 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
712 "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
713 \(Round toward +inf.\)")
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
714 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
715 register Lisp_Object arg;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
716 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
717 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
718 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
719 return make_float (d);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
720 }
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
721
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
722 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
723 "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
724 \(Round towards -inf.\)")
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
725 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
726 register Lisp_Object arg;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
727 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
728 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
729 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
730 return make_float (d);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
731 }
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
732
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
733 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
734 "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
735 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
736 register Lisp_Object arg;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
737 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
738 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
739 IN_FLOAT (d = rint (XFLOAT (arg)->data), "fround", arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
740 return make_float (d);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
741 }
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
742
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
743 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
744 "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
745 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
746 (arg)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
747 register Lisp_Object arg;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
748 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
749 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
750 if (d >= 0.0)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
751 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
752 else
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
753 IN_FLOAT (d = ceil (d), arg);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
754 return make_float (d);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
755 }
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
756 #endif
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
757
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
758 #ifdef FLOAT_CATCH_SIGILL
621
eca8812e61cd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
759 static SIGTYPE
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
760 float_error (signo)
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
761 int signo;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
762 {
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
763 if (! in_float)
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
764 fatal_error_signal (signo);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
765
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
766 #ifdef BSD
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
767 #ifdef BSD4_1
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
768 sigrelse (SIGILL);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
769 #else /* not BSD4_1 */
638
40b255f55df3 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 624
diff changeset
770 sigsetmask (SIGEMPTYMASK);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
771 #endif /* not BSD4_1 */
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
772 #else
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
773 /* Must reestablish handler each time it is called. */
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
774 signal (SIGILL, float_error);
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 102
diff changeset
775 #endif /* BSD */
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
776
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
777 in_float = 0;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
778
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
779 Fsignal (Qarith_error, Fcons (float_error_arg, Qnil));
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
780 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
781
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
782 /* 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
783 where SIGILL is signaled. */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
784
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
785 #endif /* FLOAT_CATCH_SIGILL */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
786
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
787 #ifdef HAVE_MATHERR
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
788 int
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
789 matherr (x)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
790 struct exception *x;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
791 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
792 Lisp_Object args;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
793 if (! in_float)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
794 /* 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
795 return 0;
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
796 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
797 x->name = "expt";
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
798
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
799 args
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
800 = 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
801 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
802 ((!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
803 ? 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
804 : Qnil)));
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
805 switch (x->type)
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
806 {
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
807 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
808 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
809 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
810 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
811 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
812 }
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
813 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
814 }
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
815 #endif /* HAVE_MATHERR */
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
816
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
817 init_floatfns ()
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 #ifdef FLOAT_CATCH_SIGILL
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
820 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
821 #endif
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
822 in_float = 0;
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
823 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
824
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
825 syms_of_floatfns ()
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
826 {
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
827 defsubr (&Sacos);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
828 defsubr (&Sasin);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
829 defsubr (&Satan);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
830 defsubr (&Scos);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
831 defsubr (&Ssin);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
832 defsubr (&Stan);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
833 #if 0
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
834 defsubr (&Sacosh);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
835 defsubr (&Sasinh);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
836 defsubr (&Satanh);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
837 defsubr (&Scosh);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
838 defsubr (&Ssinh);
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
839 defsubr (&Stanh);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
840 defsubr (&Sbessel_y0);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
841 defsubr (&Sbessel_y1);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
842 defsubr (&Sbessel_yn);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
843 defsubr (&Sbessel_j0);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
844 defsubr (&Sbessel_j1);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
845 defsubr (&Sbessel_jn);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
846 defsubr (&Serf);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
847 defsubr (&Serfc);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
848 defsubr (&Slog_gamma);
2094
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
849 defsubr (&Scube_root);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
850 defsubr (&Sfceiling);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
851 defsubr (&Sffloor);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
852 defsubr (&Sfround);
c77607f8e32d (FLOAT_CHECK_ERRNO): Define unless NO_FLOAT_CHECK_ERRNO.
Richard M. Stallman <rms@gnu.org>
parents: 1918
diff changeset
853 defsubr (&Sftruncate);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
854 #endif
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
855 defsubr (&Sexp);
683
7f4d77d29804 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 638
diff changeset
856 defsubr (&Sexpt);
102
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
857 defsubr (&Slog);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
858 defsubr (&Slog10);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
859 defsubr (&Ssqrt);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
860
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
861 defsubr (&Sabs);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
862 defsubr (&Sfloat);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
863 defsubr (&Slogb);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
864 defsubr (&Sceiling);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
865 defsubr (&Sfloor);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
866 defsubr (&Sround);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
867 defsubr (&Struncate);
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
868 }
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
869
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
870 #else /* not LISP_FLOAT_TYPE */
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
871
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
872 init_floatfns ()
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
873 {}
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
874
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
875 syms_of_floatfns ()
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
876 {}
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
877
0d3a6b3b64a4 Initial revision
Mike Rowan <mtr@gnu.org>
parents:
diff changeset
878 #endif /* not LISP_FLOAT_TYPE */