> Saying that FLT_EVAL_METHOD==0 robs you of the ability to choose
Kahan never defined something like FLT_EVAL_METHOD==0, he wrote the PDF you linked to, and the PDF doesn't contain claims that in the form you say it does, and I'm not making them either. He says in his suggestion to "fix" Java, among other things: calculate the partial results which aren't specified explicitly to higher precision, the target sizes should be respected as the programmers specified them. That is not what the example program produced with -O flag. And I don't see anywhere that what Kahan suggested has equivalence to
http://en.cppreference.com/w/cpp/types/climits/FLT_EVAL_METH...
"FLT_EVAL_METHOD==2 all operations and constants evaluate in the range and precision of long double. Additionally, both float_t and double_t are equivalent to long double"
He never mentions something like "float_t" and "double_t" there as far as I saw? He mentions K&R C which never had any of these. And where float x = something meant x is 32-bits. And tan( x ) meant pass 32-bit x to the double tan and return double, and float y = tan( x ) meant store the double returned from tan as 32-bits.
The program in the example that started the discussion is explicitly producing two double sums (that is, that's what the programmer wrote) so it should never compare one 80-bit and one 64-bit sum. That behavior is surely not something that you can find in Kahan's suggestions.
Please read once Kahan's document carefully to see if he writes what you believe he writes (because you keep referring to the definition he didn't make, and he explicitly knew that not "everything should be long double"). I claim he doesn't.
> An implementation of 80-bit floating point that doesn't allow you to store an 80-bit value in a variable is pretty much a toy implementation no matter what.
x87 instructions have it: FSTP m80fp and Kahan wanted that in the higher level languages too (pg. 77).
"Names for primitive floating-point types or for Borneo floating-point classes:"
"long double = 10+-byte IEEE 754 Double Extended with at least 64 sig. bits etc."
He also writes (pg. 43 of his PDF):
"Of course explicit casts and
assignments to a narrower precision must round superfluous digits away as the programmer directs"
And on page 80, regarding false arguments:
"At first sight, a frequently occurring assignment X = Y¤Z involving
floats X, Y, Z in just one algebraic operation ¤ appears to require that Y and Z be converted to double, and
that Y¤Z be computed and rounded to double, and then rounded again to float to be stored in X . The same
result X ( and the same exceptions if any ) are obtained sooner by rounding Y¤Z to float directly." That is, the standard and the x87 are already designed that it can be done directly.