2 ms·
Offtopic, but I think that languages should have special float types that trigger the use of fast math. That way, a programmer can better control which parts of
by amelius 7y ago
Offtopic, but I think that languages should have special float types that trigger the use of fast math. That way, a programmer can better control which parts of a program are done with approximate floating point operations.
- slavik81 7y agoOne of the reasons why I think Zig looks appealing is that you can set the policy for these sorts of things on a per-block basis: https://ziglang.org/documentation/master/#setFloatMode https://ziglang.org/documentation/master/#setFloatMode
- amelius 7y agoImho that's too fine-grained. Usually you determine which variables don't need strict accuracy rather than which code, so that's better controlled through types. Also, it's easy to limit approximations to code blocks by casting to/from approximate types around a code block so you can still have fine grained control.