Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/public-domain/sqlite/dist Try to avoid using float ...



details:   https://anonhg.NetBSD.org/src/rev/3950104721e2
branches:  trunk
changeset: 327607:3950104721e2
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Mar 12 20:00:22 2014 +0000

description:
Try to avoid using float constants out of range

diffstat:

 external/public-domain/sqlite/dist/sqlite3.c |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (43 lines):

diff -r 0bd27dab5352 -r 3950104721e2 external/public-domain/sqlite/dist/sqlite3.c
--- a/external/public-domain/sqlite/dist/sqlite3.c      Wed Mar 12 19:42:18 2014 +0000
+++ b/external/public-domain/sqlite/dist/sqlite3.c      Wed Mar 12 20:00:22 2014 +0000
@@ -7538,6 +7538,7 @@
 #  include <float.h>
 #  define SQLITE_BIG_DBL DBL_MAX
 #  define SQLITE_HUGE_DBL DBL_MAX
+#  define SQLITE_HUGE_COST 1e38
 # endif
 #endif
 #ifndef SQLITE_BIG_DBL
@@ -7549,6 +7550,9 @@
 #ifndef SQLITE_MAX_SQL_LENGTH
 # define SQLITE_MAX_SQL_LENGTH 1000000000
 #endif
+#ifndef SQLITE_HUGE_COST
+# define SQLITE_HUGE_COST 1e50
+#endif
 
 /*
 ** The maximum depth of an expression tree. This is limited to 
@@ -20406,8 +20410,12 @@
         }
         if( realvalue>0.0 ){
           LONGDOUBLE_TYPE scale = 1.0;
+#if __DBL_MAX_10_EXP__ > 100
           while( realvalue>=1e100*scale && exp<=350 ){ scale *= 1e100;exp+=100;}
+#endif
+#if __DBL_MAX_10_EXP__ > 64
           while( realvalue>=1e64*scale && exp<=350 ){ scale *= 1e64; exp+=64; }
+#endif
           while( realvalue>=1e8*scale && exp<=350 ){ scale *= 1e8; exp+=8; }
           while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
           realvalue /= scale;
@@ -125559,7 +125567,7 @@
         ** function MATCH in the requested context" error. To discourage
         ** this, return a very high cost here.  */
         pInfo->idxNum = FTS3_FULLSCAN_SEARCH;
-        pInfo->estimatedCost = 1e50;
+        pInfo->estimatedCost = SQLITE_HUGE_COST;
         fts3SetEstimatedRows(pInfo, ((sqlite3_int64)1) << 50);
         return SQLITE_OK;
       }



Home | Main Index | Thread Index | Old Index