From 1e6305830b12483a43501f79d84b54828d98dbe0 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 23 Nov 2020 00:21:18 -0600 Subject: [PATCH 1/3] Specify rounding as half to even --- spec/API_specification/elementwise_functions.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spec/API_specification/elementwise_functions.md b/spec/API_specification/elementwise_functions.md index 7cf30a149..56bb8d116 100644 --- a/spec/API_specification/elementwise_functions.md +++ b/spec/API_specification/elementwise_functions.md @@ -1136,10 +1136,17 @@ Returns the remainder of division for each element `x1_i` of the input array `x1 Rounds each element `x_i` of the input array `x` to the nearest integer-valued number. +```{note} + +The default rounding mode must be round half to even (i.e., rounding ties to the nearest even integer). +``` + +_TODO: consider supporting alternative rounding modes, such as round half away from zero, round half toward zero, etc. This is possible in other environments, such as Julia, where users can control the rounding mode._ + #### Special Cases - If `x_i` is already integer-valued, the result is `x_i`. -- If two integers are equally close to `x_i`, the result is whichever integer is farthest from `0`. +- If two integers are equally close to `x_i`, the result is the even integer closest to `x_i`. #### Parameters From bb5f0f44ac43b0089eb81f2311054b505d43a905 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 23 Nov 2020 12:02:50 -0600 Subject: [PATCH 2/3] Remove TODO --- spec/API_specification/elementwise_functions.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/API_specification/elementwise_functions.md b/spec/API_specification/elementwise_functions.md index 56bb8d116..f3c9272ed 100644 --- a/spec/API_specification/elementwise_functions.md +++ b/spec/API_specification/elementwise_functions.md @@ -1141,8 +1141,6 @@ Rounds each element `x_i` of the input array `x` to the nearest integer-valued n The default rounding mode must be round half to even (i.e., rounding ties to the nearest even integer). ``` -_TODO: consider supporting alternative rounding modes, such as round half away from zero, round half toward zero, etc. This is possible in other environments, such as Julia, where users can control the rounding mode._ - #### Special Cases - If `x_i` is already integer-valued, the result is `x_i`. From d422b26be04f969e5fababd10375b418da1ce130 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Mon, 23 Nov 2020 16:09:22 -0600 Subject: [PATCH 3/3] Remove note --- spec/API_specification/elementwise_functions.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/spec/API_specification/elementwise_functions.md b/spec/API_specification/elementwise_functions.md index f3c9272ed..0ec38f9c5 100644 --- a/spec/API_specification/elementwise_functions.md +++ b/spec/API_specification/elementwise_functions.md @@ -1136,11 +1136,6 @@ Returns the remainder of division for each element `x1_i` of the input array `x1 Rounds each element `x_i` of the input array `x` to the nearest integer-valued number. -```{note} - -The default rounding mode must be round half to even (i.e., rounding ties to the nearest even integer). -``` - #### Special Cases - If `x_i` is already integer-valued, the result is `x_i`.