Skip to content

Commit d8b7302

Browse files
doc: Add example for NaN comparison (#38953)
1 parent 78d3ff4 commit d8b7302

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

doc/src/manual/integers-and-floating-point-numbers.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ the real number line:
369369
| `-Inf16` | `-Inf32` | `-Inf` | negative infinity | a value less than all finite floating-point values |
370370
| `NaN16` | `NaN32` | `NaN` | not a number | a value not `==` to any floating-point value (including itself) |
371371

372+
372373
For further discussion of how these non-finite floating-point values are ordered with respect
373374
to each other and other floats, see [Numeric Comparisons](@ref). By the [IEEE 754 standard](https://en.wikipedia.org/wiki/IEEE_754-2008),
374375
these floating-point values are the results of certain arithmetic operations:
@@ -409,6 +410,18 @@ NaN
409410
410411
julia> 0 * Inf
411412
NaN
413+
414+
julia> NaN == NaN
415+
false
416+
417+
julia> NaN != NaN
418+
true
419+
420+
julia> NaN < NaN
421+
false
422+
423+
julia> NaN > NaN
424+
false
412425
```
413426

414427
The [`typemin`](@ref) and [`typemax`](@ref) functions also apply to floating-point types:

0 commit comments

Comments
 (0)