Re:9999999999999999.0 – 9999999999999998.0
by banthar on Saturday January 05, 2019 @06:36PM
(#18835129)
Constant expressions are evaluated at compile time.
Compilation would suffer any eventual performance penalties.
This probably makes the compiler simpler - no need to implement different arithmetic for different types & no need to guess the types.
The dangerous bit is, that just extracting a variable from constant expressions might change the result slightly. That should not be a problem, unless you are depending on exact values.
Re:9999999999999999.0 – 9999999999999998.0
by int_19h on Saturday January 05, 2019 @08:37PM
(#18835758)
The dangerous part is that now the value of the computation can change slightly if it's no longer constant. So e.g. if it involves a named constant, and that constant then becomes a variable for some reason (e.g. because it now needs to be computed at runtime, because it varies from platform to platform), you can end up with broken code with no warning.
Why?
My thoughts: 1) more inefficient programs because encountering an arbitrary-precision expression requires arbitrarily large memory and computation, 2) more complicated language implementation.