We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b9a464 commit 875b9faCopy full SHA for 875b9fa
src/type/convert.jl
@@ -11,18 +11,10 @@ convert(::Type{Float32}, x::Double32) = HI(x)
11
convert(::Type{Float16}, x::Double16) = HI(x)
12
13
convert(::Type{DoubleFloat{T}}, x::I) where {T<:IEEEFloat, I<:Integer} = DoubleFloat{T}(T(x))
14
+
15
function convert(::Type{I}, x::DoubleFloat{T}) where {T<:IEEEFloat, I<:Integer}
16
bi = trunc(BigInt, BigFloat(HI(x)) + BigFloat(LO(x)))
- 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
+ convert(Int64, bi)
26
end
27
28
function convert(::Type{BigFloat}, x::DoubleFloat{T}) where {T<:IEEEFloat}
0 commit comments