aboutsummaryrefslogtreecommitdiff
path: root/src/func.c
diff options
context:
space:
mode:
authordan <Dan Kennedy>2020-12-10 18:07:01 +0000
committerdan <Dan Kennedy>2020-12-10 18:07:01 +0000
commit46a6b1a1be69c85e203afdcdaa68b84e6dab2ed0 (patch)
tree8499aae6b41a6c37fe9170aef7ed9ead71ce08e6 /src/func.c
parent7aae73588aeb9fd33d26f0d0a654bfbebdccf72c (diff)
parent70f3eda5bedef47246d14a03e6ce4ce8a5c2ff50 (diff)
downloadsqlite-46a6b1a1be69c85e203afdcdaa68b84e6dab2ed0.tar.gz
sqlite-46a6b1a1be69c85e203afdcdaa68b84e6dab2ed0.zip
Merge trunk changes into this branch.
FossilOrigin-Name: 7337eed629b4537b8fc2dc87c3c71d0a664128a91fd00f3c5f18843505beee90
Diffstat (limited to 'src/func.c')
-rw-r--r--src/func.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/func.c b/src/func.c
index 169f23143..a29088a68 100644
--- a/src/func.c
+++ b/src/func.c
@@ -2021,10 +2021,10 @@ static void math1Func(
int argc,
sqlite3_value **argv
){
- assert( argc==1 );
int type0;
double v0, ans;
double (*x)(double);
+ assert( argc==1 );
type0 = sqlite3_value_numeric_type(argv[0]);
if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
v0 = sqlite3_value_double(argv[0]);
@@ -2043,10 +2043,10 @@ static void math2Func(
int argc,
sqlite3_value **argv
){
- assert( argc==2 );
int type0, type1;
double v0, v1, ans;
double (*x)(double,double);
+ assert( argc==2 );
type0 = sqlite3_value_numeric_type(argv[0]);
if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
type1 = sqlite3_value_numeric_type(argv[1]);
@@ -2082,9 +2082,9 @@ static void signFunc(
int argc,
sqlite3_value **argv
){
- assert( argc==1 );
int type0;
double x;
+ assert( argc==1 );
type0 = sqlite3_value_numeric_type(argv[0]);
if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
x = sqlite3_value_double(argv[0]);
@@ -2213,7 +2213,9 @@ void sqlite3RegisterBuiltinFunctions(void){
MFUNCTION(ceil, 1, ceil, ceilingFunc ),
MFUNCTION(ceiling, 1, ceil, ceilingFunc ),
MFUNCTION(floor, 1, floor, ceilingFunc ),
+#if SQLITE_HAVE_C99_MATH_FUNCS
MFUNCTION(trunc, 1, trunc, ceilingFunc ),
+#endif
FUNCTION(ln, 1, 0, 0, logFunc ),
FUNCTION(log, 1, 1, 0, logFunc ),
FUNCTION(log10, 1, 1, 0, logFunc ),
@@ -2233,9 +2235,11 @@ void sqlite3RegisterBuiltinFunctions(void){
MFUNCTION(cosh, 1, cosh, math1Func ),
MFUNCTION(sinh, 1, sinh, math1Func ),
MFUNCTION(tanh, 1, tanh, math1Func ),
+#if SQLITE_HAVE_C99_MATH_FUNCS
MFUNCTION(acosh, 1, acosh, math1Func ),
MFUNCTION(asinh, 1, asinh, math1Func ),
MFUNCTION(atanh, 1, atanh, math1Func ),
+#endif
MFUNCTION(sqrt, 1, sqrt, math1Func ),
MFUNCTION(radians, 1, degToRad, math1Func ),
MFUNCTION(degrees, 1, radToDeg, math1Func ),