diff --git a/Project.toml b/Project.toml index 3a4cdfb..de85ed0 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ReverseDiff" uuid = "37e2e3b7-166d-5795-8a7a-e32c996b4267" -version = "1.16.1" +version = "1.16.2" [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" diff --git a/src/tracked.jl b/src/tracked.jl index 7b2753d..1198dea 100644 --- a/src/tracked.jl +++ b/src/tracked.jl @@ -433,6 +433,9 @@ Base.rand(rng::Random.AbstractRNG, ::Type{TrackedReal{V,D,O}}) where {V,D,O} = T Base.eps(t::TrackedReal) = eps(value(t)) Base.eps(::Type{T}) where {T<:TrackedReal} = eps(valtype(T)) +Base.floatmax(::Type{T}) where {T<:TrackedReal} = floatmax(valtype(T)) +Base.floatmin(::Type{T}) where {T<:TrackedReal} = floatmin(valtype(T)) + Base.floor(t::TrackedReal) = floor(value(t)) Base.floor(::Type{R}, t::TrackedReal) where {R<:Real} = floor(R, value(t)) diff --git a/test/TrackedTests.jl b/test/TrackedTests.jl index 18420ba..006490a 100644 --- a/test/TrackedTests.jl +++ b/test/TrackedTests.jl @@ -733,6 +733,7 @@ tp = InstructionTape() tr_int = TrackedReal(v_int, d, tp) tr_float = TrackedReal(v_float, d, tp) tr_float2 = TrackedReal(v_float2, d2, tp) +tr_float32 = TrackedReal(Float32(v_float), Float32(d), tp) @test hash(tr_float) === hash(v_float) @test hash(tr_float, hash(1)) === hash(v_float, hash(1)) @@ -756,6 +757,11 @@ tr_rand = rand(MersenneTwister(1), TrackedReal{Int,Float64,Nothing}) @test eps(tr_float) === eps(v_float) @test eps(typeof(tr_float)) === eps(Float64) +@test floatmin(typeof(tr_float)) === floatmin(Float64) +@test floatmin(typeof(tr_float32)) === floatmin(Float32) +@test floatmax(typeof(tr_float)) === floatmax(Float64) +@test floatmax(typeof(tr_float32)) === floatmax(Float32) + @test floor(tr_float) === floor(v_float) @test floor(Int, tr_float) === floor(Int, v_float)