From d1dd444687a76051f16cfd8f04f8619f21cfbc95 Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Thu, 26 Jul 2018 23:26:12 -0400 Subject: [PATCH] Minor floatmin/max cleanup, add deprecation --- base/deprecated.jl | 2 ++ base/float.jl | 4 ++-- doc/src/base/base.md | 4 ++-- test/mpfr.jl | 2 +- test/numbers.jl | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/base/deprecated.jl b/base/deprecated.jl index 1778b808b7574..d239eab40f29a 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -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 diff --git a/base/float.jl b/base/float.jl index 0e5507f00bdfc..231578e640b53 100644 --- a/base/float.jl +++ b/base/float.jl @@ -740,7 +740,7 @@ end end """ - realmin(T) + floatmin(T) The smallest in absolute value non-subnormal value representable by the given floating-point DataType `T`. @@ -748,7 +748,7 @@ 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`. diff --git a/doc/src/base/base.md b/doc/src/base/base.md index e09600c9c1a8f..0ed440e9472b0 100644 --- a/doc/src/base/base.md +++ b/doc/src/base/base.md @@ -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) diff --git a/test/mpfr.jl b/test/mpfr.jl index 7684d7c979ea7..5cb6339e4eaec 100644 --- a/test/mpfr.jl +++ b/test/mpfr.jl @@ -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 diff --git a/test/numbers.jl b/test/numbers.jl index 85c5749b43d76..cee655a77a7d6 100644 --- a/test/numbers.jl +++ b/test/numbers.jl @@ -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