rint.3: Document that halfway cases are rounded to even.
PATCH 1/1 rint.3: Document that halfway cases are rounded to even.
Per IEEE-754 rounding rules.
The round(3) page describes the behavior of rint and nearbyint in the halfway cases by saying:
These functions round x to the nearest integer, but round halfway cases away from zero [...], instead of to the nearest even integer like rint(3)
--- man3/rint.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
man3/rint.3 +1 -1
@@ -92,7 +92,7 @@ and functions round their argument to an integer value in floating-point format, using the current rounding direction (see .BR fesetround (3)) -and without raising the +and round halfway cases to the nearest even integer, without raising the .I inexact exception. .LP
Signature · 6 lines
2.0.5 -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1426207416-7539-1-git-send-email-mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 11 lines · Matt Turner
Per IEEE-754 rounding rules.
The round(3) page describes the behavior of rint and nearbyint in the halfway cases by saying:
These functions round x to the nearest integer, but round halfway cases away from zero [...], instead of to the nearest even integer like rint(3)
Signed-off-by Matt Turner <[email protected]>---
Sorry, this is not precise -- these functions round halfway cases to nearest even when the rounding mode is set to round-to-nearest. I'll send a revised patch.
And for what it's worth, as far as I can tell this rounding behavior (halfway cases round to nearest even) is defined by IEEE-754 and not the C language spec. I don't know if that's worth mentioning. --
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CAEdQ38EGO7wONjO-3qBNm_aWMX+1WOj0xGrRvE81hTpG-xE79w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
PATCH 1/1 rint.3: Document that halfway cases are rounded to even.
Per IEEE-754 rounding rules.
The round(3) page describes the behavior of rint and nearbyint in the halfway cases by saying:
These functions round x to the nearest integer, but round halfway cases away from zero [...], instead of to the nearest even integer like rint(3)
--- man3/rint.3 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
man3/rint.3 +3 -1
@@ -94,7 +94,9 @@ format, using the current rounding direction (see .BR fesetround (3)) and without raising the .I inexact -exception. +exception. When the current rounding direction is to nearest, these +functions round halfway cases to the even integer in accordance with +IEEE-754. .LP The .BR rint (),
Signature · 6 lines
2.0.5 -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1426211007-9986-1-git-send-email-mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 8 lines · Matt Turner
Per IEEE-754 rounding rules.
The round(3) page describes the behavior of rint and nearbyint in the halfway cases by saying:
These functions round x to the nearest integer, but round halfway cases away from zero [...], instead of to the nearest even integer like rint(3)
Thanks, Matt. Applied.
Cheers,
Michael
Quoted 21 lines
Signed-off-by Matt Turner <[email protected]>--- man3/rint.3 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)man3/rint.3 +3
-1@@ -94,7 +94,9 @@ format, using the current rounding direction (see .BR fesetround (3)) and without raising the .I inexact -exception. +exception. When the current rounding direction is to nearest, these +functions round halfway cases to the even integer in accordance with +IEEE-754. .LP The .BR rint (),
Signature · 7 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html