Skip to content

Commit

Permalink
Merge pull request #132 from JuliaMath/stevengj-patch-1
Browse files Browse the repository at this point in the history
support precision(x, base=...) in Julia 1.8
  • Loading branch information
JeffreySarnoff authored Oct 25, 2021
2 parents caad59e + f4fa0db commit 2f307fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Double.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,10 @@ DoubleFloat(x::Int64) = Double64(x, zero(Int64))
DoubleFloat(x::Int32) = Double32(x, zero(Int32))
DoubleFloat(x::Int16) = Double16(x, zero(Int16))


precision(::Type{DoubleFloat{T}}) where {T<:IEEEFloat} = 2*precision(T)
# overload Base._precision to support the base keyword in Julia 1.8
let precision = isdefined(Base, :_precision) ? :_precision : :precision
@eval Base.$precision(::Type{DoubleFloat{T}}) where {T<:IEEEFloat} = 2*Base.$precision(T)
end

eltype(::Type{Double64}) = Double64
eltype(::Type{Double32}) = Double32
Expand Down

0 comments on commit 2f307fe

Please sign in to comment.