Skip to content

Commit 5cd596d

Browse files
authored
document strong zero property of false (#34703)
1 parent 5a71af3 commit 5cd596d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/src/manual/mathematical-operations.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ julia> 3*2/12
5151
operators. For instance, we would generally write `-x + 2` to reflect that first `x` gets negated,
5252
and then `2` is added to that result.)
5353

54+
When used in multiplication, `false` acts as a *strong zero*:
55+
56+
```jldoctest
57+
julia> NaN * false
58+
0.0
59+
60+
julia> false * Inf
61+
0.0
62+
```
63+
64+
This is useful for preventing the propagation of `NaN` values in quantities that are known to be zero. See [Knuth (1992)](https://arxiv.org/abs/math/9205211) for motivation.
65+
5466
## Bitwise Operators
5567

5668
The following [bitwise operators](https://en.wikipedia.org/wiki/Bitwise_operation#Bitwise_operators)

0 commit comments

Comments
 (0)