}
}
+#if defined(SQLITE_ENABLE_MATH_FUNCTIONS) || defined(_WIN32)
+/*
+** Use the ceil() and floor() from the standard math library.
+*/
+static double seriesCeil(double r){ return ceil(r); }
+static double seriesFloor(double r){ return floor(r); }
+#elif defined(__GNUC__) && !defined(SQLITE_DISABLE_INTRINSIC)
+/*
+** If the standard library is not available, try to use GCC builtins
+*/
+static double seriesCeil(double r){ return __builtin_ceil(r); }
+static double seriesFloor(double r){ return __builtin_floor(r); }
+#else
+/*
+** If there is no standard library and we are not using GCC, then
+** use an approximation. Results are not exact, but
+** that is the best we can do.
+*/
+static double seriesCeil(double r){
+ sqlite3_int64 x = (sqlite3_int64)r;
+ if( r==(double)x ) return r;
+ if( r<0.0 ) x++;
+ return (double)x;
+}
+static double seriesFloor(double r){
+ sqlite3_int64 x = (sqlite3_int64)r;
+ if( r==(double)x ) return r;
+ if( r>0.0 ) x--;
+ return (double)x;
+}
+#endif
+
/*
** This method is called to "rewind" the series_cursor object back
** to the first row of output. This method is always called at least
if( idxNum & 0x0080 ){ /* value=X */
if( sqlite3_value_numeric_type(argv[iArg])==SQLITE_FLOAT ){
double r = sqlite3_value_double(argv[iArg++]);
- if( r==ceil(r)
+ if( r==seriesCeil(r)
&& r>=(double)SMALLEST_INT64
&& r<=(double)LARGEST_INT64
){
double r = sqlite3_value_double(argv[iArg++]);
if( r<(double)SMALLEST_INT64 ){
iMin = SMALLEST_INT64;
- }else if( (idxNum & 0x0200)!=0 && r==ceil(r) ){
- iMin = (sqlite3_int64)ceil(r+1.0);
+ }else if( (idxNum & 0x0200)!=0 && r==seriesCeil(r) ){
+ iMin = (sqlite3_int64)seriesCeil(r+1.0);
}else{
- iMin = (sqlite3_int64)ceil(r);
+ iMin = (sqlite3_int64)seriesCeil(r);
}
}else{
iMin = sqlite3_value_int64(argv[iArg++]);
double r = sqlite3_value_double(argv[iArg++]);
if( r>(double)LARGEST_INT64 ){
iMax = LARGEST_INT64;
- }else if( (idxNum & 0x2000)!=0 && r==floor(r) ){
+ }else if( (idxNum & 0x2000)!=0 && r==seriesFloor(r) ){
iMax = (sqlite3_int64)(r-1.0);
}else{
- iMax = (sqlite3_int64)floor(r);
+ iMax = (sqlite3_int64)seriesFloor(r);
}
}else{
iMax = sqlite3_value_int64(argv[iArg++]);
-C Back\sout\s[8bf26c956e].\sIt\sis\snot\srequired\sfollowing\s[8e7da8cf50].
-D 2025-10-10T16:04:19.837
+C Provide\salternative\simplementations\sof\sceil()\sand\sfloor()\sto\sthe\ngenerate_series()\sfunction\sso\sthat\sit\swill\sbuild\seven\swhen\sSQLite\sis\ncompiled\susing\s--disable-math.\n[forum:/forumpost/91690fa646|Forum\spost\s91690fa646].
+D 2025-10-10T19:43:03.506
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F ext/misc/remember.c add730f0f7e7436cd15ea3fd6a90fd83c3f706ab44169f7f048438b7d6baa69c
F ext/misc/rot13.c 51ac5f51e9d5fd811db58a9c23c628ad5f333c173f1fc53c8491a3603d38556c
F ext/misc/scrub.c 2a44b0d44c69584c0580ad2553f6290a307a49df4668941d2812135bfb96a946
-F ext/misc/series.c cbbec483aa0246661e7656971ce4de8e62ecc3151be94218306206fe4f5b7a9e
+F ext/misc/series.c 85874485c36dff3c6ea5d236f860e31775b709052a017add23ad9503ad286674
F ext/misc/sha1.c cb5002148c2661b5946f34561701e9105e9d339b713ec8ac057fd888b196dcb9
F ext/misc/shathree.c fd22d70620f86a0467acfdd3acd8435d5cb54eb1e2d9ff36ae44e389826993df
F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 4966d7a1ce42af8b1c50fdd40e651e80d0eeb8cb62dd882950cab275f98aba88
-R b942099604595f11d845c663da1ef706
-U dan
-Z 13a143275403dfceaee76597c8ba1588
+P ea29180797aa4bb25180432e75a372277a6f6e2262906a9e765a3bddf8ca79d7
+R f66b4b2fbe19b1c6a42732547da0b69d
+U drh
+Z 66d7804c79c61408dbcb9030c8856ced
# Remove this line to create a well-formed Fossil manifest.