Skip to content

Commit 4e51c5b

Browse files
authored
Add note to negative for signed integer dtype behavior (#270)
* Add note and remove empty lines * Add dunder method note
1 parent 5565ac4 commit 4e51c5b

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

spec/API_specification/array_object.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,10 @@ Element-wise results must equal the results returned by the equivalent element-w
934934

935935
Evaluates `-self_i` for each element of an array instance.
936936

937+
```{note}
938+
For signed integer data types, the numerical negative of the minimum representable integer is implementation-dependent.
939+
```
940+
937941
#### Parameters
938942

939943
- **self**: _<array>_

spec/API_specification/elementwise_functions.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ For floating-point operands,
128128
- In the remaining cases, when neither `infinity`, `+0`, `-0`, nor a `NaN` is involved, and the operands have the same mathematical sign or have different magnitudes, the sum must be computed and rounded to the nearest representable value according to IEEE 754-2019 and a supported round mode. If the magnitude is too large to represent, the operation overflows and the result is an `infinity` of appropriate mathematical sign.
129129

130130
```{note}
131-
132131
Floating-point addition is a commutative operation, but not always associative.
133132
```
134133

@@ -237,7 +236,6 @@ Calculates an implementation-dependent approximation of the inverse tangent of t
237236
The mathematical signs of `x1_i` and `x2_i` determine the quadrant of each element-wise result. The quadrant (i.e., branch) is chosen such that each element-wise result is the signed angle in radians between the ray ending at the origin and passing through the point `(1,0)` and the ray ending at the origin and passing through the point `(x2_i, x1_i)`.
238237

239238
```{note}
240-
241239
Note the role reversal: the "y-coordinate" is the first function parameter; the "x-coordinate" is the second function parameter. The parameter order is intentional and traditional for the two-argument inverse tangent function where the y-coordinate argument is first and the x-coordinate argument is second.
242240
```
243241

@@ -402,7 +400,6 @@ Computes the bitwise OR of the underlying binary representation of each element
402400
Shifts the bits of each element `x1_i` of the input array `x1` to the right according to the respective element `x2_i` of the input array `x2`.
403401

404402
```{note}
405-
406403
This operation must be an arithmetic shift (i.e., sign-propagating) and thus equivalent to floor division by a power of two.
407404
```
408405

@@ -620,7 +617,6 @@ For floating-point operands,
620617
Calculates an implementation-dependent approximation to `exp(x)-1`, having domain `[-infinity, +infinity]` and codomain `[-1, +infinity]`, for each element `x_i` of the input array `x`.
621618

622619
```{note}
623-
624620
The purpose of this function is to calculate `exp(x)-1.0` more accurately when `x` is close to zero. Accordingly, conforming implementations should avoid implementing this function as simply `exp(x)-1.0`. See FDLIBM, or some other IEEE 754-2019 compliant mathematical library, for a potential reference implementation.
625621
```
626622

@@ -856,7 +852,6 @@ For floating-point operands,
856852
Calculates an implementation-dependent approximation to `log(1+x)`, where `log` refers to the natural (base `e`) logarithm, having domain `[-1, +infinity]` and codomain `[-infinity, +infinity]`, for each element `x_i` of the input array `x`.
857853

858854
```{note}
859-
860855
The purpose of this function is to calculate `log(1+x)` more accurately when `x` is close to zero. Accordingly, conforming implementations should avoid implementing this function as simply `log(1+x)`. See FDLIBM, or some other IEEE 754-2019 compliant mathematical library, for a potential reference implementation.
861856
```
862857

@@ -1085,7 +1080,6 @@ For floating-point operands,
10851080
- In the remaining cases, where neither `infinity` nor `NaN` is involved, the product must be computed and rounded to the nearest representable value according to IEEE 754-2019 and a supported rounding mode. If the magnitude is too large to represent, the result is an `infinity` of appropriate mathematical sign. If the magnitude is too small to represent, the result is a zero of appropriate mathematical sign.
10861081

10871082
```{note}
1088-
10891083
Floating-point multiplication is not always associative due to finite precision.
10901084
```
10911085

@@ -1110,6 +1104,10 @@ Floating-point multiplication is not always associative due to finite precision.
11101104

11111105
Computes the numerical negative of each element `x_i` (i.e., `y_i = -x_i`) of the input array `x`.
11121106

1107+
```{note}
1108+
For signed integer data types, the numerical negative of the minimum representable integer is implementation-dependent.
1109+
```
1110+
11131111
#### Parameters
11141112

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

0 commit comments

Comments
 (0)