Skip to content

Commit 875b9fa

Browse files
Update convert.jl
1 parent 1b9a464 commit 875b9fa

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/type/convert.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,10 @@ convert(::Type{Float32}, x::Double32) = HI(x)
1111
convert(::Type{Float16}, x::Double16) = HI(x)
1212

1313
convert(::Type{DoubleFloat{T}}, x::I) where {T<:IEEEFloat, I<:Integer} = DoubleFloat{T}(T(x))
14+
1415
function convert(::Type{I}, x::DoubleFloat{T}) where {T<:IEEEFloat, I<:Integer}
1516
bi = trunc(BigInt, BigFloat(HI(x)) + BigFloat(LO(x)))
16-
abi = abs(bi)
17-
if abi <= typemax(Int)
18-
convert(Int, bi)
19-
elseif abi <= typemax(Int64)
20-
convert(Int64, bi)
21-
elseif abi <= typemax(Int128)
22-
convert(Int128, bi)
23-
else
24-
bi
25-
end
17+
convert(Int64, bi)
2618
end
2719

2820
function convert(::Type{BigFloat}, x::DoubleFloat{T}) where {T<:IEEEFloat}

0 commit comments

Comments
 (0)