------- Comment #2 from dirk dot herrmann-privat at gmx dot de 2009-10-05 16:48 ------- Hi,
thanks for considering my report. The relevant sections seem to be (these were pointed out to me on comp.lang.ada by Adam Beneschan): 4.9(38) : "For a real static expression that is not part of a larger static expression ... the implementation shall round or truncate the value (according to the Machine_Rounds attribute of the expected type) to the nearest machine number of the expected type...". 4.9(38.1/2): "The rounding of static floating point expressions is implementation-defined. It is recommended that the rounding be the same as the default rounding on the target system." A.5.4(3): S'Machine_Rounds: Yields the value True if rounding is performed on inexact results of every predefined operation that yields a result of the type T; yields the value False otherwise. The value of this attribute is of the predefined type Boolean. Here's the interpretation (for which I also used some input from comp.lang.ada by Adam Beneschan): 4.9(38) demands rounding or truncation for real static expressions, depending on the value of Machine_Rounds. A.5.4(3) is not limited to static expressions, but relates "Machine_Rounds = True" to rounding. The behaviour in case of "Machine_Rounds = False" is left open by A.5.4(3), though. The implementation advice in 4.9(38.1/2) recommends that static rounding should be the same as the default rounding. There is no explicit statement with respect to how non-static expressions should be handled in case of "Machine_Rounds = False". But, 4.9(38.1/2) can be interpreted such that it is generally desired that static and non-static behaviour should match. Therefore: 4.9(38) demands truncation for static expressions in case of "Machine_Rounds = False", and it seems plausible to me that this should then also apply for non-static expressions. Thanks again, Dirk -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41416