Hacker News new | ask | show | jobs
by mhh__ 1387 days ago
In D you can opt into specific float algorithms locally rather than a compiler flag.

Use of fast math can really really really bite you sometimes, so just being able to opt into using fma and nothing else is awesome.

2 comments

I've measured it on real workload twice with LDC and each time "@fastMath" made things 1% slower. Of course this varies from backend to backend, but such woes would be avoided if the flag was named differently than "fast". It doesn't seem worth it to use it.
I got a good speed up in [insert work project here] but that was more of an experiment since it isn't really performance constrained in the first place.
Yeah, Julia has this also (via a @fastmath macro). It's incredibly nice to be able to apply it safely.