Skip to content

Commit 50e43c0

Browse files
Merge pull request #215 from JuliaMath/os/use-less-BigFloat
Remove BigFloat from conversions and decompose for small DoubleFloats
2 parents bdf1855 + 6aaa42a commit 50e43c0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Double.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ Double64(x::Double16) = isfinite(x) ? Double64(two_sum(Float64(HI(x)), Float64(L
199199
Promote a `Double16` to a `Double32` by converting the `hi` and `lo` attributes
200200
of `x` to `Double32`s and adding in extended precision.
201201
"""
202-
Double32(x::Double16) = isfinite(x) ? Double32(BigFloat(x)) : Double32(Float32(x))
203-
Double32(x::Double64) = isfinite(x) ? Double32(BigFloat(x)) : Double32(Float32(x))
204-
Double16(x::Double64) = isfinite(x) ? Double16(BigFloat(x)) : Double16(Float16(x))
205-
Double16(x::Double32) = isfinite(x) ? Double16(BigFloat(x)) : Double16(Float16(x))
202+
Double32(x::Double16) = isfinite(x) ? Double32(two_sum(Float32(HI(x)), Float32(LO(x)))) : Double32(Float32(x))
203+
Double32(x::Double64) = Double32(HI(x))
204+
Double16(x::Double64) = Double16(HI(x))
205+
Double16(x::Double32) = Double16(HI(x))
206206

207207
# cleanup to support other pkgs
208208
DoubleFloat(x::Float64) = Double64(x, 0.0)
@@ -245,5 +245,5 @@ function Base.decompose(x::Double64)
245245
return decompose(BigFloat(x))
246246
end
247247
function Base.decompose(x::D) where {D<:Union{Double32,Double16}}
248-
return decompose(Double64(x))
248+
return decompose(Float64(x))
249249
end

0 commit comments

Comments
 (0)