tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Tinycc issues


From: Henrik Nordstrom
Subject: Re: [Tinycc-devel] Tinycc issues
Date: Wed, 16 Mar 2005 00:04:16 +0100 (CET)

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.

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.

Regards
Henrik




reply via email to

[Prev in Thread] Current Thread [Next in Thread]