/ Check-in [3adfe9f3]
Login

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

Overview
Comment:Remove still more unnecessary branches from sqlite3AtoF().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3adfe9f3e6ce7cc09fcb570d9b65e830a96cac15
User & Date: drh 2016-04-27 02:35:03
Context
2016-04-27
15:24
More simplification of the sqlite3AtoF() routine. Add special comments to indicate branches that are for optimization purposes only and that give the correct answer even if always or never taken. check-in: 0065fe97 user: drh tags: trunk
02:35
Remove still more unnecessary branches from sqlite3AtoF(). check-in: 3adfe9f3 user: drh tags: trunk
2016-04-26
23:14
Further simplifications to sqlite3AtoF() to remove unneeded branches. check-in: dd69e53c user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/util.c.

427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
...
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
      e = e<10000 ? (e*10 + (*z - '0')) : 10000;
      z+=incr;
      eValid = 1;
    }
  }

  /* skip trailing spaces */
  if( nDigits && eValid ){
    while( z<zEnd && sqlite3Isspace(*z) ) z+=incr;
  }

do_atof_calc:
  /* adjust exponent by d, and update sign */
  e = (e*esign) + d;
  if( e<0 ) {
    esign = -1;
    e *= -1;
................................................................................
    esign = 1;
  }

  /* if 0 significand */
  if( !s ) {
    /* In the IEEE 754 standard, zero is signed.
    ** Add the sign if we've seen at least one digit */
    result = (sign<0 && nDigits) ? -(double)0 : (double)0;
  } else {
    /* attempt to reduce exponent */
    if( esign>0 ){
      while( s<(LARGEST_INT64/10) && e>0 ) e--,s*=10;
    }else{
      while( !(s%10) && e>0 ) e--,s/=10;
    }







<
|
<







 







|







427
428
429
430
431
432
433

434

435
436
437
438
439
440
441
...
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
      e = e<10000 ? (e*10 + (*z - '0')) : 10000;
      z+=incr;
      eValid = 1;
    }
  }

  /* skip trailing spaces */

  while( z<zEnd && sqlite3Isspace(*z) ) z+=incr;


do_atof_calc:
  /* adjust exponent by d, and update sign */
  e = (e*esign) + d;
  if( e<0 ) {
    esign = -1;
    e *= -1;
................................................................................
    esign = 1;
  }

  /* if 0 significand */
  if( !s ) {
    /* In the IEEE 754 standard, zero is signed.
    ** Add the sign if we've seen at least one digit */
    result = sign<0 ? -(double)0 : (double)0;
  } else {
    /* attempt to reduce exponent */
    if( esign>0 ){
      while( s<(LARGEST_INT64/10) && e>0 ) e--,s*=10;
    }else{
      while( !(s%10) && e>0 ) e--,s/=10;
    }