Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/tracked.jl
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,12 @@ 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(t::TrackedReal) = floatmax(value(t))
Base.floatmax(::Type{T}) where {T<:TrackedReal} = floatmax(valtype(T))

Base.floatmin(t::TrackedReal) = floatmin(value(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))

Expand Down
6 changes: 6 additions & 0 deletions test/TrackedTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,12 @@ tr_rand = rand(MersenneTwister(1), TrackedReal{Int,Float64,Nothing})
@test eps(tr_float) === eps(v_float)
@test eps(typeof(tr_float)) === eps(Float64)

@test floatmax(tr_float) === floatmax(v_float)
@test floatmax(typeof(tr_float)) === floatmax(Float64)

@test floatmin(tr_float) === floatmin(v_float)
@test floatmin(typeof(tr_float)) === floatmin(Float64)

@test floor(tr_float) === floor(v_float)
@test floor(Int, tr_float) === floor(Int, v_float)

Expand Down
Loading