MultiFloats.jl
MultiFloats.jl copied to clipboard
Promotion of Irrationals
julia> pi * Float64x4(2)
ERROR: MethodError: Cannot `convert` an object of type Irrational{:π} to an object of type NTuple{4, Float64}
Perhaps there might be a way to convert these to BigFloat
and then to MultiFloat
s
julia> 2Float64x4(big(pi))
6.283185307179586476925286766559005768394338798750211641949889184604
Hey @jishnub , good catch! I totally overlooked this in my own testing. You're right, a conversion to BigFloat
(with the precision set to the appropriate level) and then to MultiFloat
is absolutely the right way to do it. I'll get this implemented in the next version of MultiFloats.jl.
I hit the same problem. A fix could be something like:
function MultiFloat{T,N}(x::Union{Rational{S},Irrational{S}}) where {S,T,N}
MultiFloat{T,N}(BigFloat(x; precision = precision(MultiFloat{T,N})))
end
then I get
Float64x2(π)
3.141592653589793238462643383279506
Hey everyone! It's been ages since I last looked at MultiFloats.jl, but I've finally pushed a fix for this in commit 02091e0.