Skip to content

Commit 81fb410

Browse files
mileslucasStefanKarpinski
authored andcommitted
update mod2pi note about 2pi behavior (JuliaLang#33853)
1 parent 6d26f14 commit 81fb410

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

base/math.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,12 @@ This function computes a floating point representation of the modulus after divi
10571057
numerically exact `2π`, and is therefore not exactly the same as `mod(x,2π)`, which would
10581058
compute the modulus of `x` relative to division by the floating-point number `2π`.
10591059
1060+
!!! note
1061+
Depending on the format of the input value, the closest representable value to 2π may
1062+
be less than 2π. For example, the expression `mod2pi(2π)` will not return `0`, because
1063+
the intermediate value of `2*π` is a `Float64` and `2*Float64(π) < 2*big(π)`. See
1064+
[`rem2pi`](@ref) for more refined control of this behavior.
1065+
10601066
# Examples
10611067
```jldoctest
10621068
julia> mod2pi(9*pi/4)

0 commit comments

Comments
 (0)