Skip to content

Commit 65305a4

Browse files
authored
Add guidance for when rounding special floating-point values (#312)
* Add guidance for when rounding special floating-point values * Update cases
1 parent 3a6d47f commit 65305a4

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

spec/API_specification/elementwise_functions.md

+32
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,14 @@ Rounds each element `x_i` of the input array `x` to the smallest (i.e., closest
449449

450450
- If `x_i` is already integer-valued, the result is `x_i`.
451451

452+
For floating-point operands,
453+
454+
- If `x_i` is `+infinity`, the result is `+infinity`.
455+
- If `x_i` is `-infinity`, the result is `-infinity`.
456+
- If `x_i` is `+0`, the result is `+0`.
457+
- If `x_i` is `-0`, the result is `-0`.
458+
- If `x_i` is `NaN`, the result is `NaN`.
459+
452460
#### Parameters
453461

454462
- **x**: _<array>_
@@ -651,6 +659,14 @@ Rounds each element `x_i` of the input array `x` to the greatest (i.e., closest
651659

652660
- If `x_i` is already integer-valued, the result is `x_i`.
653661

662+
For floating-point operands,
663+
664+
- If `x_i` is `+infinity`, the result is `+infinity`.
665+
- If `x_i` is `-infinity`, the result is `-infinity`.
666+
- If `x_i` is `+0`, the result is `+0`.
667+
- If `x_i` is `-0`, the result is `-0`.
668+
- If `x_i` is `NaN`, the result is `NaN`.
669+
654670
#### Parameters
655671

656672
- **x**: _<array>_
@@ -1245,6 +1261,14 @@ Rounds each element `x_i` of the input array `x` to the nearest integer-valued n
12451261
#### Special Cases
12461262

12471263
- If `x_i` is already integer-valued, the result is `x_i`.
1264+
1265+
For floating-point operands,
1266+
1267+
- If `x_i` is `+infinity`, the result is `+infinity`.
1268+
- If `x_i` is `-infinity`, the result is `-infinity`.
1269+
- If `x_i` is `+0`, the result is `+0`.
1270+
- If `x_i` is `-0`, the result is `-0`.
1271+
- If `x_i` is `NaN`, the result is `NaN`.
12481272
- If two integers are equally close to `x_i`, the result is the even integer closest to `x_i`.
12491273

12501274
#### Parameters
@@ -1462,6 +1486,14 @@ Rounds each element `x_i` of the input array `x` to the integer-valued number th
14621486

14631487
- If `x_i` is already integer-valued, the result is `x_i`.
14641488

1489+
For floating-point operands,
1490+
1491+
- If `x_i` is `+infinity`, the result is `+infinity`.
1492+
- If `x_i` is `-infinity`, the result is `-infinity`.
1493+
- If `x_i` is `+0`, the result is `+0`.
1494+
- If `x_i` is `-0`, the result is `-0`.
1495+
- If `x_i` is `NaN`, the result is `NaN`.
1496+
14651497
#### Parameters
14661498

14671499
- **x**: _<array>_

0 commit comments

Comments
 (0)