|
From: | Dominic Mazzoni |
Subject: | Re: [Tinycc-devel] Tinycc issues |
Date: | Tue, 15 Mar 2005 16:06:41 -0800 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616 |
Henrik Nordstrom wrote:
On Tue, 15 Mar 2005, Dominic Mazzoni wrote:1. NaN in floating-point constants: It is sometimes appropriate for a user-defined numerical function to return NaN. Normally I do this by defining a constant in my code, like this: float NAN_FLOAT = (float)(0.0 / 0.0);This is undefined. May be either a quiet NaN or a signalling NaN depending on the floating point implementation.
That's true, although for all practical purposes all modern CPUs use IEEE floats, which is well-defined, and all modern POSIX systems let you control whether to use quiet or signalling NaNs...
You should use the NAN macro if available. Example (Linux): #define _ISOC99_SOURCE #include <math.h> int main(int argc, char **argv) { printf("%f\n", NAN); }If NAN is not defined (it's a macro) then the floating point implementation does not support quiet NaNs.
Thanks, that will work fine. However, the crash in tinycc should still be fixed. :) - Dominic
Regards Henrik _______________________________________________ Tinycc-devel mailing list address@hidden http://lists.nongnu.org/mailman/listinfo/tinycc-devel
[Prev in Thread] | Current Thread | [Next in Thread] |