/ Check-in [4d9edbc5]
Login

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

Overview
Comment:Use a built-in atof() function instead of the one from the library to avoid problems with locale. Ticket #305. (CVS 1144)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4d9edbc50f7dee64edbadad2e2dc4f93d8248b3b
User & Date: drh 2003-12-23 02:17:35
Context
2003-12-23
03:06
Test functions tolerate an "0x" before a pointer value. Ticket #452. (CVS 1145) check-in: c6c5e07b user: drh tags: trunk
02:17
Use a built-in atof() function instead of the one from the library to avoid problems with locale. Ticket #305. (CVS 1144) check-in: 4d9edbc5 user: drh tags: trunk
2003-12-22
14:53
Optimizations to the LEMON parser template. (CVS 1143) check-in: 06db29df user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/date.c.

    12     12   ** This file contains the C functions that implement date and time
    13     13   ** functions for SQLite.  
    14     14   **
    15     15   ** There is only one exported symbol in this file - the function
    16     16   ** sqliteRegisterDateTimeFunctions() found at the bottom of the file.
    17     17   ** All other code has file scope.
    18     18   **
    19         -** $Id: date.c,v 1.1 2003/11/01 01:53:54 drh Exp $
           19  +** $Id: date.c,v 1.2 2003/12/23 02:17:35 drh Exp $
    20     20   **
    21     21   ** NOTES:
    22     22   **
    23     23   ** SQLite processes all times and dates as Julian Day numbers.  The
    24     24   ** dates and times are stored as the number of days since noon
    25     25   ** in Greenwich on November 24, 4714 B.C. according to the Gregorian
    26     26   ** calendar system.
................................................................................
   318    318       if( sqliteOsCurrentTime(&r)==0 ){
   319    319         p->rJD = r;
   320    320         p->validJD = 1;
   321    321         return 0;
   322    322       }
   323    323       return 1;
   324    324     }else if( sqliteIsNumber(zDate) ){
   325         -    p->rJD = atof(zDate);
          325  +    p->rJD = sqliteAtoF(zDate);
   326    326       p->validJD = 1;
   327    327       return 0;
   328    328     }
   329    329     return 1;
   330    330   }
   331    331   
   332    332   /*

Changes to src/func.c.

    12     12   ** This file contains the C functions that implement various SQL
    13     13   ** functions of SQLite.  
    14     14   **
    15     15   ** There is only one exported symbol in this file - the function
    16     16   ** sqliteRegisterBuildinFunctions() found at the bottom of the file.
    17     17   ** All other code has file scope.
    18     18   **
    19         -** $Id: func.c,v 1.33 2003/11/01 01:53:54 drh Exp $
           19  +** $Id: func.c,v 1.34 2003/12/23 02:17:35 drh Exp $
    20     20   */
    21     21   #include <ctype.h>
    22     22   #include <math.h>
    23     23   #include <stdlib.h>
    24     24   #include <assert.h>
    25     25   #include "sqliteInt.h"
    26     26   #include "os.h"
................................................................................
   145    145     double r;
   146    146     char zBuf[100];
   147    147     assert( argc==1 || argc==2 );
   148    148     if( argv[0]==0 || (argc==2 && argv[1]==0) ) return;
   149    149     n = argc==2 ? atoi(argv[1]) : 0;
   150    150     if( n>30 ) n = 30;
   151    151     if( n<0 ) n = 0;
   152         -  r = atof(argv[0]);
          152  +  r = sqliteAtoF(argv[0]);
   153    153     sprintf(zBuf,"%.*f",n,r);
   154    154     sqlite_set_result_string(context, zBuf, -1);
   155    155   }
   156    156   
   157    157   /*
   158    158   ** Implementation of the upper() and lower() SQL functions.
   159    159   */
................................................................................
   393    393   ** Routines used to compute the sum or average.
   394    394   */
   395    395   static void sumStep(sqlite_func *context, int argc, const char **argv){
   396    396     SumCtx *p;
   397    397     if( argc<1 ) return;
   398    398     p = sqlite_aggregate_context(context, sizeof(*p));
   399    399     if( p && argv[0] ){
   400         -    p->sum += atof(argv[0]);
          400  +    p->sum += sqliteAtoF(argv[0]);
   401    401       p->cnt++;
   402    402     }
   403    403   }
   404    404   static void sumFinalize(sqlite_func *context){
   405    405     SumCtx *p;
   406    406     p = sqlite_aggregate_context(context, sizeof(*p));
   407    407     sqlite_set_result_double(context, p ? p->sum : 0.0);
................................................................................
   431    431   */
   432    432   static void stdDevStep(sqlite_func *context, int argc, const char **argv){
   433    433     StdDevCtx *p;
   434    434     double x;
   435    435     if( argc<1 ) return;
   436    436     p = sqlite_aggregate_context(context, sizeof(*p));
   437    437     if( p && argv[0] ){
   438         -    x = atof(argv[0]);
          438  +    x = sqliteAtoF(argv[0]);
   439    439       p->sum += x;
   440    440       p->sum2 += x*x;
   441    441       p->cnt++;
   442    442     }
   443    443   }
   444    444   static void stdDevFinalize(sqlite_func *context){
   445    445     double rN = sqlite_aggregate_count(context);

Changes to src/printf.c.

   753    753     zNew = malloc( sMprintf.nChar+1 );
   754    754     if( zNew ) strcpy(zNew,sMprintf.zText);
   755    755     if( sMprintf.zText!=sMprintf.zBase ){
   756    756       sqliteFree(sMprintf.zText);
   757    757     }
   758    758     return zNew;
   759    759   }
          760  +
          761  +/* 
          762  +** This function implements the callback from vxprintf. 
          763  +**
          764  +** This routine add nNewChar characters of text in zNewText to
          765  +** the sgMprintf structure pointed to by "arg".  Unlike mout() above,
          766  +** this routine does not allocate new space when the buffer fills.
          767  +** It just truncates.
          768  +*/
          769  +static void sout(void *arg, char *zNewText, int nNewChar){
          770  +  struct sgMprintf *pM = (struct sgMprintf*)arg;
          771  +  if( pM->nChar + nNewChar + 1 > pM->nAlloc ){
          772  +    nNewChar = pM->nAlloc - pM->nChar - 1;
          773  +    if( nNewChar<=0 ) return;
          774  +  }
          775  +  memcpy(&pM->zText[pM->nChar], zNewText, nNewChar);
          776  +  pM->nChar += nNewChar;
          777  +  pM->zText[pM->nChar] = 0;
          778  +}
          779  +
          780  +/*
          781  +** sqlite_sprintf() works like sprintf() except that it ignores the
          782  +** current locale settings.  This is important for SQLite because we
          783  +** are not able to use a "," as the decimal point in place of "." as
          784  +** specified by some locales.
          785  +*/
          786  +int sqlite_snprintf(int n, char *zBuf, const char *zFormat, ...){
          787  +  va_list ap;
          788  +  struct sgMprintf sMprintf;
          789  +
          790  +  sMprintf.nChar = 0;
          791  +  sMprintf.nAlloc = n;
          792  +  sMprintf.zText = zBuf;
          793  +  sMprintf.zBase = zBuf;
          794  +  va_start(ap,zFormat);
          795  +  vxprintf(sout,&sMprintf,zFormat,ap);
          796  +  va_end(ap);
          797  +  return sMprintf.nChar;
          798  +}
          799  +
          800  +
   760    801   
   761    802   /*
   762    803   ** The following four routines implement the varargs versions of the
   763    804   ** sqlite_exec() and sqlite_get_table() interfaces.  See the sqlite.h
   764    805   ** header files for a more detailed description of how these interfaces
   765    806   ** work.
   766    807   **

Changes to src/sqliteInt.h.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Internal interface definitions for SQLite.
    13     13   **
    14         -** @(#) $Id: sqliteInt.h,v 1.204 2003/12/07 00:24:35 drh Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.205 2003/12/23 02:17:35 drh Exp $
    15     15   */
    16     16   #include "config.h"
    17     17   #include "sqlite.h"
    18     18   #include "hash.h"
    19     19   #include "vdbe.h"
    20     20   #include "parse.h"
    21     21   #include "btree.h"
................................................................................
  1199   1199                          int mode, int nPg, Btree **ppBtree);
  1200   1200   int sqliteFixInit(DbFixer*, Parse*, int, const char*, const Token*);
  1201   1201   int sqliteFixSrcList(DbFixer*, SrcList*);
  1202   1202   int sqliteFixSelect(DbFixer*, Select*);
  1203   1203   int sqliteFixExpr(DbFixer*, Expr*);
  1204   1204   int sqliteFixExprList(DbFixer*, ExprList*);
  1205   1205   int sqliteFixTriggerStep(DbFixer*, TriggerStep*);
         1206  +double sqliteAtoF(const char *z);
         1207  +int sqlite_snprintf(int,char*,const char*,...);

Changes to src/test1.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Code for testing the printf() interface to SQLite.  This code
    13     13   ** is not included in the SQLite library.  It is used for automated
    14     14   ** testing of the SQLite library.
    15     15   **
    16         -** $Id: test1.c,v 1.28 2003/09/06 22:18:08 drh Exp $
           16  +** $Id: test1.c,v 1.29 2003/12/23 02:17:35 drh Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   #include "tcl.h"
    20     20   #include "os.h"
    21     21   #include <stdlib.h>
    22     22   #include <string.h>
    23     23   
................................................................................
   548    548         sqlite_set_result_string(context, argv[1], -1);
   549    549       }else if( argv[1]==0 ){
   550    550         sqlite_set_result_error(context, "2nd argument may not be NULL if the "
   551    551            "first argument is not \"string\"", -1);
   552    552       }else if( sqliteStrICmp(argv[0],"int")==0 ){
   553    553         sqlite_set_result_int(context, atoi(argv[1]));
   554    554       }else if( sqliteStrICmp(argv[0],"double")==0 ){
   555         -      sqlite_set_result_double(context, atof(argv[1]));
          555  +      sqlite_set_result_double(context, sqliteAtoF(argv[1]));
   556    556       }else{
   557    557         sqlite_set_result_error(context,"first argument should be one of: "
   558    558             "string int double", -1);
   559    559       }
   560    560       argc -= 2;
   561    561       argv += 2;
   562    562     }

Changes to src/tokenize.c.

    11     11   *************************************************************************
    12     12   ** An tokenizer for SQL
    13     13   **
    14     14   ** This file contains C code that splits an SQL input string up into
    15     15   ** individual tokens and sends those tokens one-by-one over to the
    16     16   ** parser for analysis.
    17     17   **
    18         -** $Id: tokenize.c,v 1.65 2003/12/06 21:43:56 drh Exp $
           18  +** $Id: tokenize.c,v 1.66 2003/12/23 02:17:35 drh Exp $
    19     19   */
    20     20   #include "sqliteInt.h"
    21     21   #include "os.h"
    22     22   #include <ctype.h>
    23     23   #include <stdlib.h>
    24     24   
    25     25   /*
................................................................................
   151    151   ** This function looks up an identifier to determine if it is a
   152    152   ** keyword.  If it is a keyword, the token code of that keyword is 
   153    153   ** returned.  If the input is not a keyword, TK_ID is returned.
   154    154   */
   155    155   int sqliteKeywordCode(const char *z, int n){
   156    156     int h;
   157    157     Keyword *p;
   158         -  if( aKeywordTable[0].len==0 ){
          158  +  static char needInit = 1;
          159  +  if( needInit ){
   159    160       /* Initialize the keyword hash table */
   160    161       sqliteOsEnterMutex();
   161         -    if( aKeywordTable[0].len==0 ){
          162  +    if( needInit ){
   162    163         int i;
   163    164         int n;
   164    165         n = sizeof(aKeywordTable)/sizeof(aKeywordTable[0]);
   165    166         for(i=0; i<n; i++){
   166    167           aKeywordTable[i].len = strlen(aKeywordTable[i].zName);
   167    168           h = sqliteHashNoCase(aKeywordTable[i].zName, aKeywordTable[i].len);
   168    169           h %= KEY_HASH_SIZE;
   169    170           aKeywordTable[i].pNext = apHashTable[h];
   170    171           apHashTable[h] = &aKeywordTable[i];
   171    172         }
          173  +      needInit = 0;
   172    174       }
   173    175       sqliteOsLeaveMutex();
   174    176     }
   175    177     h = sqliteHashNoCase(z, n) % KEY_HASH_SIZE;
   176    178     for(p=apHashTable[h]; p; p=p->pNext){
   177    179       if( p->len==n && sqliteStrNICmp(p->zName, z, n)==0 ){
   178    180         return p->tokenType;

Changes to src/util.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Utility functions used throughout sqlite.
    13     13   **
    14     14   ** This file contains functions for allocating memory, comparing
    15     15   ** strings, and stuff like that.
    16     16   **
    17         -** $Id: util.c,v 1.68 2003/10/22 22:15:28 drh Exp $
           17  +** $Id: util.c,v 1.69 2003/12/23 02:17:35 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <stdarg.h>
    21     21   #include <ctype.h>
    22     22   
    23     23   /*
    24     24   ** If malloc() ever fails, this global variable gets set to 1.
................................................................................
   645    645       z++;
   646    646       if( *z=='+' || *z=='-' ) z++;
   647    647       if( !isdigit(*z) ) return 0;
   648    648       while( isdigit(*z) ){ z++; }
   649    649     }
   650    650     return *z==0;
   651    651   }
          652  +
          653  +/*
          654  +** The string z[] is an ascii representation of a real number.
          655  +** Convert this string to a double.
          656  +**
          657  +** This routine assumes that z[] really is a valid number.  If it
          658  +** is not, the result is undefined.
          659  +**
          660  +** This routine is used instead of the library atof() function because
          661  +** the library atof() might want to use "," as the decimal point instead
          662  +** of "." depending on how locale is set.  But that would cause problems
          663  +** for SQL.  So this routine always uses "." regardless of locale.
          664  +*/
          665  +double sqliteAtoF(const char *z){
          666  +  int sign = 1;
          667  +  double v1 = 0.0;
          668  +  if( *z=='-' ){
          669  +    sign = -1;
          670  +    z++;
          671  +  }else if( *z=='+' ){
          672  +    z++;
          673  +  }
          674  +  while( isdigit(*z) ){
          675  +    v1 = v1*10.0 + (*z - '0');
          676  +    z++;
          677  +  }
          678  +  if( *z=='.' ){
          679  +    double divisor = 1.0;
          680  +    z++;
          681  +    while( isdigit(*z) ){
          682  +      v1 = v1*10.0 + (*z - '0');
          683  +      divisor *= 10.0;
          684  +      z++;
          685  +    }
          686  +    v1 /= divisor;
          687  +  }
          688  +  if( *z=='e' || *z=='E' ){
          689  +    int esign = 1;
          690  +    int eval = 0;
          691  +    double scale = 1.0;
          692  +    z++;
          693  +    if( *z=='-' ){
          694  +      esign = -1;
          695  +      z++;
          696  +    }else if( *z=='+' ){
          697  +      z++;
          698  +    }
          699  +    while( isdigit(*z) ){
          700  +      eval = eval*10 + *z - '0';
          701  +      z++;
          702  +    }
          703  +    while( eval>=64 ){ scale *= 1.0e+64; eval -= 64; }
          704  +    while( eval>=16 ){ scale *= 1.0e+16; eval -= 16; }
          705  +    while( eval>=4 ){ scale *= 1.0e+4; eval -= 4; }
          706  +    while( eval>=1 ){ scale *= 1.0e+1; eval -= 1; }
          707  +    if( esign<0 ){
          708  +      v1 /= scale;
          709  +    }else{
          710  +      v1 *= scale;
          711  +    }
          712  +  }
          713  +  return sign<0 ? -v1 : v1;
          714  +}
   652    715   
   653    716   /* This comparison routine is what we use for comparison operations
   654    717   ** between numeric values in an SQL expression.  "Numeric" is a little
   655    718   ** bit misleading here.  What we mean is that the strings have a
   656    719   ** type of "numeric" from the point of view of SQL.  The strings
   657    720   ** do not necessarily contain numbers.  They could contain text.
   658    721   **
................................................................................
   674    737     isNumA = sqliteIsNumber(atext);
   675    738     isNumB = sqliteIsNumber(btext);
   676    739     if( isNumA ){
   677    740       if( !isNumB ){
   678    741         result = -1;
   679    742       }else{
   680    743         double rA, rB;
   681         -      rA = atof(atext);
   682         -      rB = atof(btext);
          744  +      rA = sqliteAtoF(atext);
          745  +      rB = sqliteAtoF(btext);
   683    746         if( rA<rB ){
   684    747           result = -1;
   685    748         }else if( rA>rB ){
   686    749           result = +1;
   687    750         }else{
   688    751           result = 0;
   689    752         }
................................................................................
   767    830         isNumB = sqliteIsNumber(&b[1]);
   768    831         if( isNumA ){
   769    832           double rA, rB;
   770    833           if( !isNumB ){
   771    834             res = -1;
   772    835             break;
   773    836           }
   774         -        rA = atof(&a[1]);
   775         -        rB = atof(&b[1]);
          837  +        rA = sqliteAtoF(&a[1]);
          838  +        rB = sqliteAtoF(&b[1]);
   776    839           if( rA<rB ){
   777    840             res = -1;
   778    841             break;
   779    842           }
   780    843           if( rA>rB ){
   781    844             res = +1;
   782    845             break;

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.245 2003/12/10 01:31:21 drh Exp $
           46  +** $Id: vdbe.c,v 1.246 2003/12/23 02:17:35 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include "os.h"
    50     50   #include <ctype.h>
    51     51   #include "vdbeInt.h"
    52     52   
    53     53   /*
................................................................................
   183    183   ** already.
   184    184   */
   185    185   #define Stringify(P,I) if((aStack[I].flags & STK_Str)==0){hardStringify(P,I);}
   186    186   static int hardStringify(Vdbe *p, int i){
   187    187     Stack *pStack = &p->aStack[i];
   188    188     int fg = pStack->flags;
   189    189     if( fg & STK_Real ){
   190         -    sprintf(pStack->z,"%.15g",pStack->r);
          190  +    sqlite_snprintf(sizeof(pStack->z),pStack->z,"%.15g",pStack->r);
   191    191     }else if( fg & STK_Int ){
   192         -    sprintf(pStack->z,"%d",pStack->i);
          192  +    sqlite_snprintf(sizeof(pStack->z),pStack->z,"%d",pStack->i);
   193    193     }else{
   194    194       pStack->z[0] = 0;
   195    195     }
   196    196     p->zStack[i] = pStack->z;
   197    197     pStack->n = strlen(pStack->z)+1;
   198    198     pStack->flags = STK_Str;
   199    199     return 0;
................................................................................
   317    317   ** Any prior string or integer representation is retained.
   318    318   ** NULLs are converted into 0.0.
   319    319   */
   320    320   #define Realify(P,I) \
   321    321       if(((P)->aStack[(I)].flags&STK_Real)==0){ hardRealify(P,I); }
   322    322   static void hardRealify(Vdbe *p, int i){
   323    323     if( p->aStack[i].flags & STK_Str ){
   324         -    p->aStack[i].r = atof(p->zStack[i]);
          324  +    p->aStack[i].r = sqliteAtoF(p->zStack[i]);
   325    325     }else if( p->aStack[i].flags & STK_Int ){
   326    326       p->aStack[i].r = p->aStack[i].i;
   327    327     }else{
   328    328       p->aStack[i].r = 0.0;
   329    329     }
   330    330     p->aStack[i].flags |= STK_Real;
   331    331   }
................................................................................
  2087   2087         Stringify(p, i);
  2088   2088         aStack[i].flags &= ~(STK_Int|STK_Real);
  2089   2089         nByte += aStack[i].n+1;
  2090   2090       }else if( (flags & (STK_Real|STK_Int))!=0 || sqliteIsNumber(zStack[i]) ){
  2091   2091         if( (flags & (STK_Real|STK_Int))==STK_Int ){
  2092   2092           aStack[i].r = aStack[i].i;
  2093   2093         }else if( (flags & (STK_Real|STK_Int))==0 ){
  2094         -        aStack[i].r = atof(zStack[i]);
         2094  +        aStack[i].r = sqliteAtoF(zStack[i]);
  2095   2095         }
  2096   2096         Release(p, i);
  2097   2097         z = aStack[i].z;
  2098   2098         sqliteRealToSortable(aStack[i].r, z);
  2099   2099         len = strlen(z);
  2100   2100         zStack[i] = 0;
  2101   2101         aStack[i].flags = STK_Real;
................................................................................
  4664   4664     if( sqliteSafetyOn(db) ) goto abort_due_to_misuse;
  4665   4665     break;
  4666   4666   }
  4667   4667   
  4668   4668   /* An other opcode is illegal...
  4669   4669   */
  4670   4670   default: {
  4671         -  sprintf(zBuf,"%d",pOp->opcode);
         4671  +  sqlite_snprintf(sizeof(zBuf),zBuf,"%d",pOp->opcode);
  4672   4672     sqliteSetString(&p->zErrMsg, "unknown opcode ", zBuf, (char*)0);
  4673   4673     rc = SQLITE_INTERNAL;
  4674   4674     break;
  4675   4675   }
  4676   4676   
  4677   4677   /*****************************************************************************
  4678   4678   ** The cases of the switch statement above this line should all be indented
................................................................................
  4805   4805     sqliteSetString(&p->zErrMsg, sqlite_error_string(rc), (char*)0);
  4806   4806     goto vdbe_halt;
  4807   4807   
  4808   4808     /* Jump to here if a operator is encountered that requires more stack
  4809   4809     ** operands than are currently available on the stack.
  4810   4810     */
  4811   4811   not_enough_stack:
  4812         -  sprintf(zBuf,"%d",pc);
         4812  +  sqlite_snprintf(sizeof(zBuf),zBuf,"%d",pc);
  4813   4813     sqliteSetString(&p->zErrMsg, "too few operands on stack at ", zBuf, (char*)0);
  4814   4814     rc = SQLITE_INTERNAL;
  4815   4815     goto vdbe_halt;
  4816   4816   
  4817   4817     /* Jump here if an illegal or illformed instruction is executed.
  4818   4818     */
  4819   4819   VERIFY(
  4820   4820   bad_instruction:
  4821         -  sprintf(zBuf,"%d",pc);
         4821  +  sqlite_snprintf(sizeof(zBuf),zBuf,"%d",pc);
  4822   4822     sqliteSetString(&p->zErrMsg, "illegal operation at ", zBuf, (char*)0);
  4823   4823     rc = SQLITE_INTERNAL;
  4824   4824     goto vdbe_halt;
  4825   4825   )
  4826   4826   }

Changes to test/format3.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the the library is able to correctly
    13     13   # handle file-format 3 (version 2.6.x) databases.
    14     14   #
    15         -# $Id: format3.test,v 1.3 2003/06/03 01:47:12 drh Exp $
           15  +# $Id: format3.test,v 1.4 2003/12/23 02:17:35 drh Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   # Create a bunch of data to sort against
    21     21   #
    22     22   do_test format3-1.0 {
................................................................................
   682    682   do_test format3-11.1 {
   683    683     execsql {SELECT '0'=='0.0'}
   684    684   } {1}
   685    685   do_test format3-11.2 {
   686    686     execsql {SELECT '0'==0.0}
   687    687   } {1}
   688    688   do_test format3-11.3 {
   689         -  execsql {SELECT '12345678901234567890'=='12345678901234567891'}
          689  +  execsql {SELECT '123456789012345678901'=='123456789012345678900'}
   690    690   } {1}
   691    691   do_test format3-11.4 {
   692    692     execsql {
   693    693       CREATE TABLE t6(a INT UNIQUE, b TEXT UNIQUE);
   694    694       INSERT INTO t6 VALUES('0','0.0');
   695    695       SELECT * FROM t6;
   696    696     }

Changes to test/misc3.test.

     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13     13   # This file implements tests for miscellanous features that were
    14     14   # left out of other test files.
    15     15   #
    16         -# $Id: misc3.test,v 1.1 2003/12/17 23:57:36 drh Exp $
           16  +# $Id: misc3.test,v 1.2 2003/12/23 02:17:35 drh Exp $
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21     21   # Ticket #529.  Make sure an ABORT does not damage the in-memory cache
    22     22   # that will be used by subsequent statements in the same transaction.
    23     23   #
................................................................................
    63     63     catchsql {UPDATE t1 SET a=CASE a WHEN 128 THEN 127 ELSE a END, b='';}
    64     64     execsql {
    65     65       INSERT INTO t1 VALUES(200,'hello out there');
    66     66       COMMIT;
    67     67       PRAGMA integrity_check;
    68     68     }
    69     69   } ok
           70  +
           71  +# Tests of the sqliteAtoF() function in util.c
           72  +#
           73  +do_test misc3-2.1 {
           74  +  execsql {SELECT 2e-25*0.5e25}
           75  +} 1
           76  +do_test misc3-2.2 {
           77  +  execsql {SELECT 2.0e-25*000000.500000000000000000000000000000e+00025}
           78  +} 1
           79  +do_test misc3-2.3 {
           80  +  execsql {SELECT 000000000002e-0000000025*0.5e25}
           81  +} 1
           82  +do_test misc3-2.4 {
           83  +  execsql {SELECT 2e-25*0.5e250}
           84  +} 1e+225
           85  +do_test misc3-2.5 {
           86  +  execsql {SELECT 2.0e-250*0.5e25}
           87  +} 1e-225
           88  +do_test misc3-2.6 {
           89  +  execsql {SELECT '-2.0e-127' * '-0.5e27'}
           90  +} 1e-100
           91  +do_test misc3-2.7 {
           92  +  execsql {SELECT '+2.0e-127' * '-0.5e27'}
           93  +} -1e-100
           94  +do_test misc3-2.8 {
           95  +  execsql {SELECT 2.0e-27 * '+0.5e+127'}
           96  +} 1e+100
           97  +do_test misc3-2.9 {
           98  +  execsql {SELECT 2.0e-27 * '+0.000005e+132'}
           99  +} 1e+100
          100  +
    70    101   
    71    102   finish_test