/ Changes On Branch negative-zero
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch negative-zero Excluding Merge-Ins

This is equivalent to a diff from 5c6146b56a to 6ba4be66be

2019-06-12
20:51
As a special case, casting '-0.0' into numeric should yield 0. Fix for ticket [674385aeba91c774]. (check-in: 491f0f9bbd user: drh tags: trunk)
20:11
Enhancements to the printf() logic in order to render a negative zero with a minus sign. (Leaf check-in: 6ba4be66be user: drh tags: negative-zero)
13:49
Handle expressions like "expr IS TRUE COLLATE xyz" in the same way as "expr IS TRUE". Fix for [4d01eda8115b10d1]. (check-in: 5c6146b56a user: dan tags: trunk)
2019-06-11
21:02
The affinity of the unlikely() function and its cousins should be "none". Ticket [0c620df60bffd9ef] (check-in: 614ecb0af4 user: drh tags: trunk)

Changes to src/printf.c.

100
101
102
103
104
105
106







107
108
109
110
111
112
113
};

/* 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,
};








/*
** If SQLITE_OMIT_FLOATING_POINT is defined, then none of the floating point
** conversions will work.
*/
#ifndef SQLITE_OMIT_FLOATING_POINT
/*







>
>
>
>
>
>
>







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
};

/* 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.
*/
#ifndef SQLITE_OMIT_FLOATING_POINT
/*
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
        }else{
          realvalue = va_arg(ap,double);
        }
#ifdef SQLITE_OMIT_FLOATING_POINT
        length = 0;
#else
        if( precision<0 ) precision = 6;         /* Set default precision */
        if( realvalue<0.0 ){
          realvalue = -realvalue;
          prefix = '-';
        }else{
          prefix = flag_prefix;
        }
        if( xtype==etGENERIC && precision>0 ) precision--;
        testcase( precision>0xfff );







|







518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
        }else{
          realvalue = va_arg(ap,double);
        }
#ifdef SQLITE_OMIT_FLOATING_POINT
        length = 0;
#else
        if( precision<0 ) precision = 6;         /* Set default precision */
        if( realIsNeg(realvalue) ){
          realvalue = -realvalue;
          prefix = '-';
        }else{
          prefix = flag_prefix;
        }
        if( xtype==etGENERIC && precision>0 ) precision--;
        testcase( precision>0xfff );