[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r116804: Fix porting inconsistency about rounding to
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r116804: Fix porting inconsistency about rounding to even. |
Date: |
Wed, 19 Mar 2014 21:09:13 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 116804
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Wed 2014-03-19 14:09:08 -0700
message:
Fix porting inconsistency about rounding to even.
* doc/lispref/numbers.texi (Numeric Conversions, Rounding Operations):
Document that 'round' and 'fround' round to even.
* src/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.
modified:
doc/lispref/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-6155
doc/lispref/numbers.texi
numbers.texi-20091113204419-o5vbwnq5f7feedwu-6203
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/floatfns.c floatfns.c-20091113204419-o5vbwnq5f7feedwu-141
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog 2014-03-18 23:31:17 +0000
+++ b/doc/lispref/ChangeLog 2014-03-19 21:09:08 +0000
@@ -1,3 +1,9 @@
+2014-03-19 Paul Eggert <address@hidden>
+
+ Fix porting inconsistency about rounding to even.
+ * numbers.texi (Numeric Conversions, Rounding Operations):
+ Document that 'round' and 'fround' round to even.
+
2014-03-18 Juanma Barranquero <address@hidden>
* customize.texi (Variable Definitions): Recommend avoiding
=== modified file 'doc/lispref/numbers.texi'
--- a/doc/lispref/numbers.texi 2014-03-18 04:03:59 +0000
+++ b/doc/lispref/numbers.texi 2014-03-19 21:09:08 +0000
@@ -534,8 +534,7 @@
@defun round number &optional divisor
This returns @var{number}, converted to an integer by rounding towards the
nearest integer. Rounding a value equidistant between two integers
-may choose the integer closer to zero, or it may prefer an even integer,
-depending on your machine.
+returns the even integer.
@example
(round 1.2)
@@ -803,6 +802,7 @@
@defun fround float
This function rounds @var{float} to the nearest integral value,
and returns that value as a floating-point number.
+Rounding a value equidistant between two integers returns the even integer.
@end defun
@node Bitwise Operations
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-03-19 17:43:18 +0000
+++ b/src/ChangeLog 2014-03-19 21:09:08 +0000
@@ -1,3 +1,10 @@
+2014-03-19 Paul Eggert <address@hidden>
+
+ 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 <address@hidden>
* w32fns.c (reset_modifiers): Zero out keystate[] before using it.
=== modified file 'src/floatfns.c'
--- a/src/floatfns.c 2014-01-01 07:43:34 +0000
+++ b/src/floatfns.c 2014-03-19 21:09:08 +0000
@@ -428,7 +428,9 @@
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r116804: Fix porting inconsistency about rounding to even.,
Paul Eggert <=