Skip to content

Commit

Permalink
doc: Add example for NaN comparison (JuliaLang#38953)
Browse files Browse the repository at this point in the history
  • Loading branch information
krishna-vasudev authored and johanmon committed Jul 5, 2021
1 parent 94459d4 commit 17685ca
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions doc/src/manual/integers-and-floating-point-numbers.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ the real number line:
| `-Inf16` | `-Inf32` | `-Inf` | negative infinity | a value less than all finite floating-point values |
| `NaN16` | `NaN32` | `NaN` | not a number | a value not `==` to any floating-point value (including itself) |


For further discussion of how these non-finite floating-point values are ordered with respect
to each other and other floats, see [Numeric Comparisons](@ref). By the [IEEE 754 standard](https://en.wikipedia.org/wiki/IEEE_754-2008),
these floating-point values are the results of certain arithmetic operations:
Expand Down Expand Up @@ -409,6 +410,18 @@ NaN
julia> 0 * Inf
NaN
julia> NaN == NaN
false
julia> NaN != NaN
true
julia> NaN < NaN
false
julia> NaN > NaN
false
```

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

0 comments on commit 17685ca

Please sign in to comment.