Skip to content

Add guidance for when rounding special floating-point values #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions spec/API_specification/elementwise_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,14 @@ Rounds each element `x_i` of the input array `x` to the smallest (i.e., closest

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

For floating-point operands,

- If `x_i` is `+infinity`, the result is `+infinity`.
- If `x_i` is `-infinity`, the result is `-infinity`.
- If `x_i` is `+0`, the result is `+0`.
- If `x_i` is `-0`, the result is `-0`.
- If `x_i` is `NaN`, the result is `NaN`.

#### Parameters

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

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

For floating-point operands,

- If `x_i` is `+infinity`, the result is `+infinity`.
- If `x_i` is `-infinity`, the result is `-infinity`.
- If `x_i` is `+0`, the result is `+0`.
- If `x_i` is `-0`, the result is `-0`.
- If `x_i` is `NaN`, the result is `NaN`.

#### Parameters

- **x**: _<array>_
Expand Down Expand Up @@ -1237,6 +1253,14 @@ Rounds each element `x_i` of the input array `x` to the nearest integer-valued n
#### Special Cases

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

For floating-point operands,

- If `x_i` is `+infinity`, the result is `+infinity`.
- If `x_i` is `-infinity`, the result is `-infinity`.
- If `x_i` is `+0`, the result is `+0`.
- If `x_i` is `-0`, the result is `-0`.
- If `x_i` is `NaN`, the result is `NaN`.
- If two integers are equally close to `x_i`, the result is the even integer closest to `x_i`.

#### Parameters
Expand Down Expand Up @@ -1454,6 +1478,14 @@ Rounds each element `x_i` of the input array `x` to the integer-valued number th

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

For floating-point operands,

- If `x_i` is `+infinity`, the result is `+infinity`.
- If `x_i` is `-infinity`, the result is `-infinity`.
- If `x_i` is `+0`, the result is `+0`.
- If `x_i` is `-0`, the result is `-0`.
- If `x_i` is `NaN`, the result is `NaN`.

#### Parameters

- **x**: _<array>_
Expand Down