diff options
| author | Joakim Verona | 2014-06-04 23:50:06 +0200 |
|---|---|---|
| committer | Joakim Verona | 2014-06-04 23:50:06 +0200 |
| commit | ce8171797dafbde765170b79e5f154afc4872e86 (patch) | |
| tree | 264b357b484de24929a3f2d20a34e0e43c006a15 /src/floatfns.c | |
| parent | c1c9aa247cab9148916b367e719219ea0f055adb (diff) | |
| parent | b5d6fe3bf6e728c82a3ff63723d75519f7853716 (diff) | |
| download | emacs-ce8171797dafbde765170b79e5f154afc4872e86.tar.gz emacs-ce8171797dafbde765170b79e5f154afc4872e86.zip | |
upstream
Diffstat (limited to 'src/floatfns.c')
| -rw-r--r-- | src/floatfns.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/floatfns.c b/src/floatfns.c index f3d0936f888..75106a661b7 100644 --- a/src/floatfns.c +++ b/src/floatfns.c | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | /* Primitive operations on floating point for GNU Emacs Lisp interpreter. | 1 | /* Primitive operations on floating point for GNU Emacs Lisp interpreter. |
| 2 | 2 | ||
| 3 | Copyright (C) 1988, 1993-1994, 1999, 2001-2013 Free Software Foundation, | 3 | Copyright (C) 1988, 1993-1994, 1999, 2001-2014 Free Software Foundation, Inc. |
| 4 | Inc. | ||
| 5 | 4 | ||
| 6 | Author: Wolfgang Rupprecht | 5 | Author: Wolfgang Rupprecht |
| 7 | (according to ack.texi) | 6 | (according to ack.texi) |
| @@ -46,12 +45,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 46 | 45 | ||
| 47 | #include <math.h> | 46 | #include <math.h> |
| 48 | 47 | ||
| 49 | #ifndef isfinite | 48 | /* 'isfinite' and 'isnan' cause build failures on Solaris 10 with the |
| 50 | # define isfinite(x) ((x) - (x) == 0) | 49 | bundled GCC in c99 mode. Work around the bugs with simple |
| 51 | #endif | 50 | implementations that are good enough. */ |
| 52 | #ifndef isnan | 51 | #undef isfinite |
| 53 | # define isnan(x) ((x) != (x)) | 52 | #define isfinite(x) ((x) - (x) == 0) |
| 54 | #endif | 53 | #undef isnan |
| 54 | #define isnan(x) ((x) != (x)) | ||
| 55 | 55 | ||
| 56 | /* Check that X is a floating point number. */ | 56 | /* Check that X is a floating point number. */ |
| 57 | 57 | ||
| @@ -141,7 +141,7 @@ DEFUN ("tan", Ftan, Stan, 1, 1, 0, | |||
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0, | 143 | DEFUN ("isnan", Fisnan, Sisnan, 1, 1, 0, |
| 144 | doc: /* Return non nil iff argument X is a NaN. */) | 144 | doc: /* Return non nil if argument X is a NaN. */) |
| 145 | (Lisp_Object x) | 145 | (Lisp_Object x) |
| 146 | { | 146 | { |
| 147 | CHECK_FLOAT (x); | 147 | CHECK_FLOAT (x); |
| @@ -427,7 +427,9 @@ round2 (EMACS_INT i1, EMACS_INT i2) | |||
| 427 | static double | 427 | static double |
| 428 | emacs_rint (double d) | 428 | emacs_rint (double d) |
| 429 | { | 429 | { |
| 430 | return floor (d + 0.5); | 430 | double d1 = d + 0.5; |
| 431 | double r = floor (d1); | ||
| 432 | return r - (r == d1 && fmod (r, 2) != 0); | ||
| 431 | } | 433 | } |
| 432 | #endif | 434 | #endif |
| 433 | 435 | ||