]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Use "long double" to hold intermediate values when doing ascii to binary
authordrh <drh@noemail.net>
Wed, 7 Jan 2004 03:04:27 +0000 (03:04 +0000)
committerdrh <drh@noemail.net>
Wed, 7 Jan 2004 03:04:27 +0000 (03:04 +0000)
and binary to ascii conversions of floating point numbers. (CVS 1162)

FossilOrigin-Name: 8371f662d22be0a3c58e0503c7511faea1640955

manifest
manifest.uuid
src/printf.c
src/sqliteInt.h
src/util.c

index 0399378baf2db187a42bd67ec193491c73c3c261..9ec9e0d0ae181eaee685d5499214bf9045d8fe28 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sa\stypecast\sto\swork\saround\sa\sbug\sin\sthe\sMetrowerks\sCode\sWarrior\scompiler.\nTicket\s#553.\s(CVS\s1161)
-D 2004-01-07T02:52:08
+C Use\s"long\sdouble"\sto\shold\sintermediate\svalues\swhen\sdoing\sascii\sto\sbinary\nand\sbinary\sto\sascii\sconversions\sof\sfloating\spoint\snumbers.\s(CVS\s1162)
+D 2004-01-07T03:04:27
 F Makefile.in 0515ff9218ad8d5a8f6220f0494b8ef94c67013b
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -44,13 +44,13 @@ F src/pager.c 289328d8efba620eae99f6c2f6062710838a3eb4
 F src/pager.h 5da62c83443f26b1792cfd72c96c422f91aadd31
 F src/parse.y c65aa6c5508763806ac9734b0589b93480ec7e7a
 F src/pragma.c deec7342741e371f3042adaee53fcc324c5dd1d4
-F src/printf.c 09fac1bc6bb6f2ca4ac6589bee6e656dcc0499d1
+F src/printf.c 292a7bfc5a815cb6465e32b2d5c9fe9bd43b27f0
 F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
 F src/select.c d79ac60ba1595ff3c94b12892e87098329776482
 F src/shell.c 3b067edc098c45caca164bcad1fa79192c3ec5ae
 F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
 F src/sqlite.h.in e6cfff01fafc8a82ce82cd8c932af421dc9adb54
-F src/sqliteInt.h 88ab55200183355e35f8f13a6b4c27b4b48288b2
+F src/sqliteInt.h d9f2391451ae9636eb447dfa4dc35b70bfa3759d
 F src/table.c d845cb101b5afc1f7fea083c99e3d2fa7998d895
 F src/tclsqlite.c dcd18d1f0d51ac4863d1f9059f614f903bc1fffe
 F src/test1.c 1d297ca6c01601ee38d723ff08343dc01f351985
@@ -61,7 +61,7 @@ F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e
 F src/tokenize.c 5597df1fd76d6947e7da824856ac1910e2055729
 F src/trigger.c ce83e017b407d046e909d05373d7f8ee70f9f7f9
 F src/update.c 24260b4fda00c9726d27699a0561d53c0dccc397
-F src/util.c 0e3bf40dafe75805495454ff5283b552f14b5d4d
+F src/util.c 22977a29c80c027730aa4bb44854ba4b72e92a59
 F src/vacuum.c 77485a64a6e4e358170f150fff681c1624a092b0
 F src/vdbe.c a16a084ca40edeec3a2e490d6f672fc84f851dd9
 F src/vdbe.h 3957844e46fea71fd030e78f6a3bd2f7e320fb43
@@ -179,7 +179,7 @@ F www/speed.tcl 2f6b1155b99d39adb185f900456d1d592c4832b3
 F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
-P d8ae6bddeb70f1450ccd3a4735ccf6fe3a042a07
-R 222692c9664863c079a68bd8b44e806b
+P 4146f8cc3ff5339b5685e9c5121888ae08ee0807
+R a72185418e2bb2fb61e2933a561c40a9
 U drh
-Z 7366c12e01e2442c1baac6232f5fd274
+Z b12256f36463d2cff38d7ba61f10330a
index b4d49cbf98ea4a2b0f46f4731549d4833b5a19ae..85afc0d1f94afab84d11fbd4c091f3f4d57ac032 100644 (file)
@@ -1 +1 @@
-4146f8cc3ff5339b5685e9c5121888ae08ee0807
\ No newline at end of file
+8371f662d22be0a3c58e0503c7511faea1640955
\ No newline at end of file
index e32487e6f4056db6a768549ce0f44078fe6036e9..a8af91434e1f4b8d27f8f69dcfa3f71fe123f33d 100644 (file)
@@ -139,9 +139,9 @@ static et_info fmtinfo[] = {
 ** 16 (the number of significant digits in a 64-bit float) '0' is
 ** always returned.
 */
-static int et_getdigit(double *val, int *cnt){
+static int et_getdigit(LONGDOUBLE_TYPE *val, int *cnt){
   int digit;
-  double d;
+  LONGDOUBLE_TYPE d;
   if( (*cnt)++ >= 16 ) return '0';
   digit = (int)*val;
   d = digit;
@@ -202,7 +202,7 @@ static int vxprintf(
   int flag_long;            /* True if "l" flag is present */
   int flag_center;          /* True if "=" flag is present */
   unsigned long longvalue;  /* Value for integer types */
-  double realvalue;         /* Value for real types */
+  LONGDOUBLE_TYPE realvalue; /* Value for real types */
   et_info *infop;           /* Pointer to the appropriate info structure */
   char buf[etBUFSIZE];      /* Conversion buffer */
   char prefix;              /* Prefix character.  "+" or "-" or " " or '\0'. */
index 0cc8e3f9955d4487a988065e0435553e8eb3b0cd..c90190af21922dc1cc2ccba78498ed1bec4451b2 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.206 2004/01/06 01:13:47 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.207 2004/01/07 03:04:27 drh Exp $
 */
 #include "config.h"
 #include "sqlite.h"
@@ -119,6 +119,15 @@ typedef UINT8_TYPE u8;             /* 1-byte unsigned integer */
 typedef INTPTR_TYPE ptr;           /* Big enough to hold a pointer */
 typedef unsigned INTPTR_TYPE uptr; /* Big enough to hold a pointer */
 
+/*
+** Most C compilers these days recognize "long double", don't they?
+** Just in case we encounter one that does not, we will create a macro
+** for long double so that it can be easily changed to just "double".
+*/
+#ifndef LONGDOUBLE_TYPE
+# define LONGDOUBLE_TYPE long double
+#endif
+
 /*
 ** This macro casts a pointer to an integer.  Useful for doing
 ** pointer arithmetic.
index af0f31cd1a73061f610b255cdb71b3092aaed0ca..c8d2ac0ae0ea70a7069502c6beb286671d2301c6 100644 (file)
@@ -14,7 +14,7 @@
 ** This file contains functions for allocating memory, comparing
 ** strings, and stuff like that.
 **
-** $Id: util.c,v 1.70 2004/01/06 01:13:47 drh Exp $
+** $Id: util.c,v 1.71 2004/01/07 03:04:27 drh Exp $
 */
 #include "sqliteInt.h"
 #include <stdarg.h>
@@ -664,7 +664,7 @@ int sqliteIsNumber(const char *z){
 */
 double sqliteAtoF(const char *z){
   int sign = 1;
-  double v1 = 0.0;
+  LONGDOUBLE_TYPE v1 = 0.0;
   if( *z=='-' ){
     sign = -1;
     z++;
@@ -676,7 +676,7 @@ double sqliteAtoF(const char *z){
     z++;
   }
   if( *z=='.' ){
-    double divisor = 1.0;
+    LONGDOUBLE_TYPE divisor = 1.0;
     z++;
     while( isdigit(*z) ){
       v1 = v1*10.0 + (*z - '0');
@@ -688,7 +688,7 @@ double sqliteAtoF(const char *z){
   if( *z=='e' || *z=='E' ){
     int esign = 1;
     int eval = 0;
-    double scale = 1.0;
+    LONGDOUBLE_TYPE scale = 1.0;
     z++;
     if( *z=='-' ){
       esign = -1;