Brown, Daniel wrote:

>Unfortunately our build system is automated and not particularly agile, it can 
>be done but it would be preferred not to have to do that and to replace the 
>offending function instead but I've never had to write a IsNaN test.
I had a look at the sourcecode for sqlite3IsNaN():

SQLITE_PRIVATE int sqlite3IsNaN(double x){
  /* This NaN test sometimes fails if compiled on GCC with -ffast-math.
  ** On the other hand, the use of -ffast-math comes with the following
  ** warning:
  **      This option [-ffast-math] should never be turned on by any
  **      -O option since it can result in incorrect output for programs
  **      which depend on an exact implementation of IEEE or ISO
  **      rules/specifications for math functions.
  ** Under MSVC, this NaN test may fail if compiled with a floating-
  ** point precision mode other than /fp:precise.  From the MSDN
  ** documentation:
  **      The compiler [with /fp:precise] will properly handle comparisons
  **      involving NaN. For example, x != x evaluates to true if x is NaN
  **      ...
#ifdef __FAST_MATH__
# error SQLite will not work correctly with the -ffast-math option of GCC.
  volatile double y = x;
  volatile double z = y;
  return y!=z;

So it looks as if you have little choice. I'd say, Mike's suggestion is the
least painful.


sqlite-users mailing list

Reply via email to