On Tuesday, 17 May 2016 at 21:07:21 UTC, Walter Bright wrote:
[...] why an unusual case of producing a slightly worse answer trumps the usual case of producing better answers.

'Sometimes worse' is not 'better', but that's not the point, here.

Even if you managed to consistently produce not less accurate results: if the results computed at compile time differ from those computed at run time you cannot safely substitute run time calls with compile time calls without altering the result. Even slightest differences can lead to completely different outcomes.

For example, if we are interested in the number of real roots of a quadratic polynomial we compute its discriminant D. There are no solutions if D is negative, there is one solution if D is zero and there are two solutions if D is positive. In a floating point environment the crucial test is often implemented with a certain tolerance and good implementations compute the discriminant with increased precision. In any case, the critical point is that we have to make a decision based on a single computed value. A difference of one unit in the last place can change the result.

Note that this in not about correctness of the result but about reproducibility and substitutability across run time and compile time boundaries.

Please make a decision, document it, and move on.

Fool

Reply via email to