|
From: | Michael Matz |
Subject: | Re: [Tinycc-devel] NAN and INFINITY break in different ways |
Date: | Mon, 25 Dec 2017 12:49:25 +0100 (CET) |
User-agent: | Alpine 2.20 (LSU 67 2015-01-07) |
Hi, On Sun, 24 Dec 2017, Vincent Lefevre wrote:
I think we could make an exception for 0.0/0.0 and always fold this into NaN (normally division by zero is indeed not allowable in constant expressions in c99).AFAIK, the standard just implies that 0.0/0.0 is not specified as a constant expression. But the standard also says: "An implementation may accept other forms of constant expressions." Moreover, if Annex F is supported, then FP division by zero is well-defined. F7.4.2 gives examples with 0.0/0.0 in initializers, such as: static float x = 0.0/0.0; // does not raise an exception Nowadays, supporting Annex F is more or less a must.
Right you are. There are differences in rules for accepting integer constant expressions and "mere" constant expressions used e.g. for static initializers. They can (and with annex F have to) be accepted and FP exceptions be ignored at translation time. (Not so for non-static initializers where the exceptions need to be raised at runtime).
Fixed in mob. Ciao, Michael.
[Prev in Thread] | Current Thread | [Next in Thread] |