linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] rint.3: Document that halfway cases are rounded to even.
@ 2015-03-13  0:43 Matt Turner
       [not found] ` <1426207416-7539-1-git-send-email-mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Turner @ 2015-03-13  0:43 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-man-u79uwXL29TY76Z2rM5mHXA, 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 <mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 man3/rint.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man3/rint.3 b/man3/rint.3
index d1bd302..06724e3 100644
--- a/man3/rint.3
+++ b/man3/rint.3
@@ -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
-- 
2.0.5

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] rint.3: Document that halfway cases are rounded to even.
       [not found] ` <1426207416-7539-1-git-send-email-mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-03-13  1:06   ` Matt Turner
       [not found]     ` <CAEdQ38EGO7wONjO-3qBNm_aWMX+1WOj0xGrRvE81hTpG-xE79w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Turner @ 2015-03-13  1:06 UTC (permalink / raw)
  To: mtk.manpages; +Cc: linux-man

On Thu, Mar 12, 2015 at 5:43 PM, Matt Turner <mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 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 <mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---

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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch] rint.3: Document that halfway cases are rounded to even.
       [not found]     ` <CAEdQ38EGO7wONjO-3qBNm_aWMX+1WOj0xGrRvE81hTpG-xE79w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-03-13  1:43       ` Matt Turner
       [not found]         ` <1426211007-9986-1-git-send-email-mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Turner @ 2015-03-13  1:43 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-man-u79uwXL29TY76Z2rM5mHXA, 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 <mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 man3/rint.3 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/man3/rint.3 b/man3/rint.3
index d1bd302..59402a7 100644
--- a/man3/rint.3
+++ b/man3/rint.3
@@ -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 (),
-- 
2.0.5

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] rint.3: Document that halfway cases are rounded to even.
       [not found]         ` <1426211007-9986-1-git-send-email-mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-03-22 19:31           ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2015-03-22 19:31 UTC (permalink / raw)
  To: Matt Turner
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w,
	linux-man-u79uwXL29TY76Z2rM5mHXA

On 03/13/2015 02:43 AM, Matt Turner wrote:
> 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


> Signed-off-by: Matt Turner <mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  man3/rint.3 | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/man3/rint.3 b/man3/rint.3
> index d1bd302..59402a7 100644
> --- a/man3/rint.3
> +++ b/man3/rint.3
> @@ -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 (),
> 


-- 
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-22 19:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-13  0:43 [patch] rint.3: Document that halfway cases are rounded to even Matt Turner
     [not found] ` <1426207416-7539-1-git-send-email-mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-13  1:06   ` Matt Turner
     [not found]     ` <CAEdQ38EGO7wONjO-3qBNm_aWMX+1WOj0xGrRvE81hTpG-xE79w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-13  1:43       ` Matt Turner
     [not found]         ` <1426211007-9986-1-git-send-email-mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-22 19:31           ` Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).