Skip to content

Commit

Permalink
Minor floatmin/max cleanup, add deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Jul 27, 2018
1 parent 4ccde9a commit d1dd444
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,8 @@ end
@deprecate code_llvm_raw(f, types=Tuple) code_llvm(f, types; raw=true)

@deprecate eps ulp
@deprecate realmin floatmin
@deprecate realmax floatmax

# END 0.7 deprecations

Expand Down
4 changes: 2 additions & 2 deletions base/float.jl
Original file line number Diff line number Diff line change
Expand Up @@ -740,15 +740,15 @@ end
end

"""
realmin(T)
floatmin(T)
The smallest in absolute value non-subnormal value representable by the given
floating-point DataType `T`.
"""
floatmin(x::T) where {T<:AbstractFloat} = floatmin(T)

"""
realmax(T)
floatmax(T)
The highest finite value representable by the given floating-point DataType `T`.
Expand Down
4 changes: 2 additions & 2 deletions doc/src/base/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ Base.datatype_pointerfree
```@docs
Base.typemin
Base.typemax
Base.realmin
Base.realmax
Base.floatmin
Base.floatmax
Base.maxintfloat
Base.ulp(::Type{<:AbstractFloat})
Base.ulp(::AbstractFloat)
Expand Down
2 changes: 1 addition & 1 deletion test/mpfr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ end
@test BigFloat(1) + x == BigFloat(1) + prevfloat(x)
@test ulp(BigFloat) == ulp(BigFloat(1))
end
@testset "realmin/realmax" begin
@testset "floatmin/floatmax" begin
x = floatmin(BigFloat)
@test x > 0
@test prevfloat(x) == 0
Expand Down
2 changes: 1 addition & 1 deletion test/numbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,7 @@ end
@test 0xf.fP1 === 31.875
@test -0x1.0p2 === -4.0
end
@testset "ulp / realmin / realmax" begin
@testset "ulp / floatmin / floatmax" begin
@test 0x1p-52 == ulp()
@test 0x1p-52 + 1 != 1
@test 0x1p-53 + 1 == 1
Expand Down

0 comments on commit d1dd444

Please sign in to comment.