Closed lrnv closed 3 years ago
Hey @lrnv , no worries! As you can see, I've been taking a bit of a break recently too. :)
I had a look at your code, and there is an issue I would like to point out. The stop-gap implementation you have here does not consider the precision of BigFloat
when performing the conversions. In Julia, the default precision of BigFloat
is 256 bits, which is not enough for Float64x5
, ..., Float64x8
. Therefore, instead of this:
Base.exp(x::MF{T,N}) where {T,N} = MF{T,N}(exp(BigFloat(x)))
We need something like this:
Base.exp(x::MF{T,N}) where {T,N} = setprecision(BigFloat, N * precision(T) + (N - 1)) do
MF{T,N}(exp(BigFloat(x)))
end
In practice I would probably use something like N * precision(T) + (N - 1) + 20
instead, just to have a bit of safety margin. I will go ahead, accept this PR, and make this change myself.
After some more thought, I've decided that I don't want to expose these stop-gaps by default. The issue is that a new user may write, say, asinh(Float64x4(2.3))
, observe that it is quite slow, and think something is wrong with MultiFloats.jl, when in reality it is asinh(::BigFloat)
that is the culprit. I would like to strike a compromise where the stop-gap is available if you need it, but you have to consciously opt-in to using something that has suboptimal performance.
What I'll do is have asinh(::MultiFloat)
throw the following error by default:
asinh(MultiFloat) is not yet implemented. You can call MultiFloats.use_bigfloat_transcendentals()
for a temporary workaround, but this will not be as fast as a pure-MultiFloat implementation.
As the error message indicates, you can enable the stop-gap by calling MultiFloats.use_bigfloat_transcendentals()
immediately after importing MultiFloats.jl.
This is perfect for me. Thanks a lot !
Should close issues #7 and #8
Sorry for the delay, i took chritsmas vacations ;)
I did some testing but it's not perfect. Maybe we should write tests to be sure everything works ?