The exponent function gives an error on Double64, and does not seem to be covered by tests: https://app.codecov.io/gh/JuliaMath/DoubleFloats.jl/blob/master/src/math/prearith/prearith.jl
julia> exponent(123.4)
6
julia> exponent(Double64(123.4))
ERROR: DomainError with 0.0:
Cannot be ±0.0.
Stacktrace:
[1] (::Base.Math.var"#throw2#6")(x::Float64)
@ Base.Math ./math.jl:846
[2] exponent
@ ./math.jl:851 [inlined]
[3] exponent(x::Double64)
@ DoubleFloats ~/.julia/packages/DoubleFloats/h3HrU/src/math/prearith/prearith.jl:64
julia> exponent(big(123.4))
6
I think it's calling exponent(0.0), to make a tuple, like that made by significand:
julia> significand(123.4)
1.928125
julia> significand(Double64(123.4))
(1.928125, 0.0)
julia> significand(big(123.4))
1.928125000000000088817841970012523233890533447265625
More generally, is this the right thing to return? I would expect the results to obey x == significand(x) * 2^exponent(x), but this isn't possible if they return tuples. Maybe significand should return another Double64? If these tuples are needed, they could be internal functions, not overloads of Base.
The context is that it would be nice if JuliaStats/LogExpFunctions.jl#48 could work on AbstractFloat.
The exponent function gives an error on Double64, and does not seem to be covered by tests: https://app.codecov.io/gh/JuliaMath/DoubleFloats.jl/blob/master/src/math/prearith/prearith.jl
I think it's calling
exponent(0.0), to make a tuple, like that made bysignificand:More generally, is this the right thing to return? I would expect the results to obey
x == significand(x) * 2^exponent(x), but this isn't possible if they return tuples. Maybesignificandshould return another Double64? If these tuples are needed, they could be internal functions, not overloads of Base.The context is that it would be nice if JuliaStats/LogExpFunctions.jl#48 could work on AbstractFloat.