@@ -83,6 +83,9 @@ const Cfloat128 = NTuple{2,VecElement{Float64}}
8383
8484struct Float128 <: AbstractFloat
8585 data:: Cfloat128
86+ function Float128 (data:: Cfloat128 )
87+ new (data)
88+ end
8689end
8790convert (:: Type{Float128} , x:: Number ) = Float128 (x)
8891
@@ -145,6 +148,10 @@ Float128(x::Float128) = x
145148Float128 (x:: Float16 ) = Float128 (Float32 (x))
146149Float16 (x:: Float128 ) = Float16 (Float64 (x)) # TODO : avoid double rounding
147150
151+ # TwicePrecision
152+ Float128 (x:: Base.TwicePrecision{Float64} ) =
153+ Float128 (x. hi) + Float128 (x. lo)
154+
148155# integer -> Float128
149156@assume_effects :foldable Float128 (x:: Int32 ) =
150157 Float128 (@ccall (quadoplib. __floatsitf (x:: Int32 ):: Cfloat128 ))
@@ -181,7 +188,7 @@ function Float128(x::UInt128)
181188 else
182189 y1 = reinterpret (Float64,UInt64 (d >> 64 ))
183190 y2 = reinterpret (Float64,(d % UInt64))
184- return Float128 ((y2,y1 ))
191+ return Float128 ((VecElement (y2), VecElement (y1) ))
185192 end
186193end
187194
@@ -205,7 +212,7 @@ function Float128(x::Int128)
205212 else
206213 y1 = reinterpret (Float64,UInt64 (d >> 64 ))
207214 y2 = reinterpret (Float64,(d % UInt64))
208- Float128 ((y2,y1 ))
215+ Float128 ((VecElement (y2), VecElement (y1) ))
209216 end
210217end
211218
0 commit comments