diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 7 | ||||
-rw-r--r-- | src/floatfns.c | 4 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 94859f1f8fd..06e4c3291b5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2014-03-19 Paul Eggert <eggert@cs.ucla.edu> + + Fix porting inconsistency about rounding to even. + * floatfns.c (emacs_rint) [!HAVE_RINT]: Round to even. + This way, the unusual !HAVE_RINT case acts like the usual + HAVE_RINT case, and we can fix the documentation accordingly. + 2014-03-19 Eli Zaretskii <eliz@gnu.org> * w32fns.c (reset_modifiers): Zero out keystate[] before using it. diff --git a/src/floatfns.c b/src/floatfns.c index 4de5f480259..ac0447ce6d6 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -428,7 +428,9 @@ round2 (EMACS_INT i1, EMACS_INT i2) static double emacs_rint (double d) { - return floor (d + 0.5); + double d1 = d + 0.5; + double r = floor (d1); + return r - (r == d1 && fmod (r, 2) != 0); } #endif |