Index: src/printf.c ================================================================== --- src/printf.c +++ src/printf.c @@ -102,10 +102,17 @@ /* Floating point constants used for rounding */ static const double arRound[] = { 5.0e-01, 5.0e-02, 5.0e-03, 5.0e-04, 5.0e-05, 5.0e-06, 5.0e-07, 5.0e-08, 5.0e-09, 5.0e-10, }; + +/* Return TRUE if a floating point number is negative, even a negative 0 */ +static int realIsNeg(double r){ + i64 x; + memcpy(&x,&r,sizeof(x)); + return x<0; +} /* ** If SQLITE_OMIT_FLOATING_POINT is defined, then none of the floating point ** conversions will work. */ @@ -513,11 +520,11 @@ } #ifdef SQLITE_OMIT_FLOATING_POINT length = 0; #else if( precision<0 ) precision = 6; /* Set default precision */ - if( realvalue<0.0 ){ + if( realIsNeg(realvalue) ){ realvalue = -realvalue; prefix = '-'; }else{ prefix = flag_prefix; }