Why is std.math slower than the C baseline?
kinke
kinke at gmx.net
Thu Jun 4 17:16:04 UTC 2020
On Thursday, 4 June 2020 at 17:04:54 UTC, H. S. Teoh wrote:
> Would LDC consider providing float/double overloads for
> std.math functions? Ideally this would be merged upstream, but
> sometimes if there's no other way to get things done...
We are mostly just waiting for the *overloads* to finally make it
upstream (e.g., blocked
https://github.com/dlang/phobos/pull/7463), so that we can
finally enable the commented-out LLVM intrinsics (e.g.,
https://github.com/ldc-developers/phobos/blob/26fac3b399c62ead78bedce7ccba9290a2cbbbf3/std/math.d#L4304-L4307). - Enabling them already would lead to a different Phobos API for LDC (e.g., log(0.1f) returning a float, not a real), that's why we've been waiting (for years).
Once the overloads are there (even by just casting and forwarding
to the `real`-implementation for now), the remaining
transcendental functions can be ported from e.g. Cephes as 2nd
step, to have proper implementations for all floating-point types.
More information about the Digitalmars-d
mailing list