Mercurial > emacs
comparison src/floatfns.c @ 621:eca8812e61cd
*** empty log message ***
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Fri, 24 Apr 1992 08:11:54 +0000 |
| parents | 8c615e453683 |
| children | 2bb7f23b7ea5 |
comparison
equal
deleted
inserted
replaced
| 620:88a29c720fa7 | 621:eca8812e61cd |
|---|---|
| 1 /* Primitive operations on floating point for GNU Emacs Lisp interpreter. | 1 /* Primitive operations on floating point for GNU Emacs Lisp interpreter. |
| 2 Copyright (C) 1988 Free Software Foundation, Inc. | 2 Copyright (C) 1988, 1992 Free Software Foundation, Inc. |
| 3 | 3 |
| 4 This file is part of GNU Emacs. | 4 This file is part of GNU Emacs. |
| 5 | 5 |
| 6 GNU Emacs is free software; you can redistribute it and/or modify | 6 GNU Emacs is free software; you can redistribute it and/or modify |
| 7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
| 8 the Free Software Foundation; either version 1, or (at your option) | 8 the Free Software Foundation; either version 2, or (at your option) |
| 9 any later version. | 9 any later version. |
| 10 | 10 |
| 11 GNU Emacs is distributed in the hope that it will be useful, | 11 GNU Emacs is distributed in the hope that it will be useful, |
| 12 but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 40 #undef sinh | 40 #undef sinh |
| 41 #define cosh(x) ((exp(x)+exp(-x))*0.5) | 41 #define cosh(x) ((exp(x)+exp(-x))*0.5) |
| 42 #define sinh(x) ((exp(x)-exp(-x))*0.5) | 42 #define sinh(x) ((exp(x)-exp(-x))*0.5) |
| 43 #endif /* VMS */ | 43 #endif /* VMS */ |
| 44 | 44 |
| 45 static float_error (); | 45 static SIGTYPE float_error (); |
| 46 | 46 |
| 47 /* Nonzero while executing in floating point. | 47 /* Nonzero while executing in floating point. |
| 48 This tells float_error what to do. */ | 48 This tells float_error what to do. */ |
| 49 | 49 |
| 50 static int in_float; | 50 static int in_float; |
| 58 as the original argument for error messages. | 58 as the original argument for error messages. |
| 59 D is normally an assignment expression. | 59 D is normally an assignment expression. |
| 60 Handle errors which may result in signals or may set errno. */ | 60 Handle errors which may result in signals or may set errno. */ |
| 61 | 61 |
| 62 #define IN_FLOAT(D, NUM) \ | 62 #define IN_FLOAT(D, NUM) \ |
| 63 (in_float = 1, errno = 0, float_error_arg = NUM, (D), \ | 63 (in_float = 1, errno = 0, float_error_arg = NUM, (D), \ |
| 64 (errno == ERANGE || errno == EDOM ? float_error () : 0), \ | 64 (errno == ERANGE || errno == EDOM ? float_error () : (SIGTYPE) 0), \ |
| 65 in_float = 0) | 65 in_float = 0) |
| 66 | 66 |
| 67 /* Extract a Lisp number as a `double', or signal an error. */ | 67 /* Extract a Lisp number as a `double', or signal an error. */ |
| 68 | 68 |
| 69 double | 69 double |
| 496 XSET (num, Lisp_Int, (int) XFLOAT (num)->data); | 496 XSET (num, Lisp_Int, (int) XFLOAT (num)->data); |
| 497 | 497 |
| 498 return num; | 498 return num; |
| 499 } | 499 } |
| 500 | 500 |
| 501 static | 501 static SIGTYPE |
| 502 float_error (signo) | 502 float_error (signo) |
| 503 int signo; | 503 int signo; |
| 504 { | 504 { |
| 505 if (! in_float) | 505 if (! in_float) |
| 506 fatal_error_signal (signo); | 506 fatal_error_signal (signo); |
