Closed GregPlowman closed 7 years ago
One can easily create a Double from a Real using Double(x), but you can't use Double{Float64}(x).
Double
Real
Double(x)
Double{Float64}(x)
I understand Double is not yet a drop-in replacement datatype, but the latter could be useful when changing datatypes throughout some section of code.
I don't fully understand what would be required, but could one of the following work?
Double{T<:AbstractFloat}(x::Real) = convert(Double{T}, T(x))
Or maybe its better to widen x argument to include all Reals rather than just AbstractFloats:
x
Reals
AbstractFloats
function convert{T<:AbstractFloat}(::Type{Double{T}}, x::Real) z = convert(T, x) Double(z, convert(T, x-z)) end
Or maybe this doesn't make sense at all.
Fixed by #18
One can easily create a
Double
from aReal
usingDouble(x)
, but you can't useDouble{Float64}(x)
.I understand
Double
is not yet a drop-in replacement datatype, but the latter could be useful when changing datatypes throughout some section of code.I don't fully understand what would be required, but could one of the following work?
Or maybe its better to widen
x
argument to include allReals
rather than justAbstractFloats
:Or maybe this doesn't make sense at all.