dzhang314 / MultiFloats.jl

Fast, SIMD-accelerated extended-precision arithmetic for Julia
MIT License
77 stars 10 forks source link

Missing method for ^ #46

Closed laurentbartholdi closed 1 month ago

laurentbartholdi commented 2 months ago

I added the following to my code:

While I'm eagerly waiting for transcendental functions, it's a useful if dirty workaround for code that relies on powers. Perhaps you want to add it?

dzhang314 commented 1 month ago

Hi @laurentbartholdi, thanks for your interest in MultiFloats.jl! I appreciate your suggestion, and I do agree that this is a nice quick-and-dirty fix if you need floating-point exponentiation in your program. However, I am deliberately not going to add support for the ^ operator in MultiFloats.jl until there is a highly-efficient pure MultiFloat implementation, as I do not want to give user the impression that this is a supported operation until I have put in the work to support it.

In general, many users have the misconception that floating-point exponentiation ^ is just another arithmetic operator, when in fact it is very expensive and requires evaluating transcendental functions. Therefore, I actually consider it a feature, not a bug, that a user has to write exp(y*log(x)) instead of x^y, making them consciously aware that exp and log are being called.

dzhang314 commented 1 month ago

Adding a reference to issue #28, which I am designating as the tracking issue for a new, higher-performance implementation of exp and log.

laurentbartholdi commented 1 month ago

Great! While I respect fully your argument, I wish to point out that

dzhang314 commented 1 month ago

Hey @laurentbartholdi, that's an excellent point -- compatibility with other packages, even ones that do silly things, is worth pursuing. I will prioritize implementation of exp and log for MultiFloats.jl and provide an implementation of ^ as soon as it is finished.