I find that one of the easiest mistakes to make when working with Arblib in Julia is to accidentally use Float64 for some internal computations. For example for x::Arb it's perfectly fine to do any of the following
2x
x / 2
x^2
π * x
x / π
x^π
But you get a wrong result for, e.g.,
2π * x
x / log(2)
x^(1 / 3) # x^(1 // 3) works though
sqrt(2) * x
One of the common things for all of the wrong examples is that they involve a conversion from AbstractFloat to Arb. The Idea I have had is to have some sort of flag or macro which, when enable, prints a warning whenever a AbstractFloat is converted to Arb. So it would behave something like
function convert(::Type{Arb}, x::AbstractFloat)
@warn "converting a $(typeof(x)) to Arb, it's possible that this is a mistake."
return Arb(x)
end
Does this sound interesting to you?
I don't know exactly how this would be implemented, I feel like it should be possible but I don't know exactly how. Any thoughts?
I find that one of the easiest mistakes to make when working with
Arblibin Julia is to accidentally useFloat64for some internal computations. For example forx::Arbit's perfectly fine to do any of the followingBut you get a wrong result for, e.g.,
One of the common things for all of the wrong examples is that they involve a conversion from
AbstractFloattoArb. The Idea I have had is to have some sort of flag or macro which, when enable, prints a warning whenever aAbstractFloatis converted toArb. So it would behave something likeDoes this sound interesting to you?
I don't know exactly how this would be implemented, I feel like it should be possible but I don't know exactly how. Any thoughts?