/ Check-in [2a74ae19]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Attempt to handle numbers at the limits of the IEEE 754 range better (nan.test now passes).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2a74ae1969aeec93576a44e11177677e6f3cea9c
User & Date: shane 2009-09-07 03:48:53
Context
2009-09-07
04:38
Warning cleanup from the MSVC compile. check-in: 26cd015c user: shane tags: trunk
03:48
Attempt to handle numbers at the limits of the IEEE 754 range better (nan.test now passes). check-in: 2a74ae19 user: shane tags: trunk
02:46
Changes to internal AtoF to improve "accuracy" when measured against built-in GCC atof(). check-in: 438e1577 user: shane tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/util.c.

   371    371       /* adjust the sign of significand */
   372    372       s = sign<0 ? -s : s;
   373    373   
   374    374       /* if exponent, scale significand as appropriate
   375    375       ** and store in result. */
   376    376       if( e ){
   377    377         double scale = 1.0;
   378         -      /* 1.0e+22 is the largest power of 10 than can be 
   379         -      ** represented exactly. */
   380         -      while( e%22 ) { scale *= 1.0e+1; e -= 1; }
   381         -      while( e>0 ) { scale *= 1.0e+22; e -= 22; }
   382         -      if( esign<0 ){
   383         -        result = s / scale;
          378  +      /* attempt to handle extremely small/large numbers better */
          379  +      if( e>307 && e<342 ){
          380  +        while( e%308 ) { scale *= 1.0e+1; e -= 1; }
          381  +        if( esign<0 ){
          382  +          result = s / scale;
          383  +          result /= 1.0e+308;
          384  +        }else{
          385  +          result = s * scale;
          386  +          result *= 1.0e+308;
          387  +        }
   384    388         }else{
   385         -        result = s * scale;
          389  +        /* 1.0e+22 is the largest power of 10 than can be 
          390  +        ** represented exactly. */
          391  +        while( e%22 ) { scale *= 1.0e+1; e -= 1; }
          392  +        while( e>0 ) { scale *= 1.0e+22; e -= 22; }
          393  +        if( esign<0 ){
          394  +          result = s / scale;
          395  +        }else{
          396  +          result = s * scale;
          397  +        }
   386    398         }
   387    399       } else {
   388    400         result = (double)s;
   389    401       }
   390    402     }
   391    403   
   392    404     /* store the result */