SQLite Forum



(1) By anonymous on 2021-05-31 13:24:31 [link] [source]

In the amalgamation the macro SQLITE_HAVE_C99_MATH_FUNCS determines whether the functions trunc, acosh, asinh, and atanh are included. However I didn't see any documentation on that macro on Compile-time Options but the functions are documented as being available on Built-In Mathematical SQL Functions .

Assuming those functions are present and desired should this macro be defined? I could have missed it but the only relationship between SQLITE_ENABLE_MATH_FUNCTIONS and SQLITE_HAVE_C99_MATH_FUNCS in sqlite3.c appears to be a special-case based on the MSVC version. It also seems that the check for --enable-math in configure only defines SQLITE_ENABLE_MATH_FUNCTIONS and not SQLITE_HAVE_C99_MATH_FUNCS.

(2) By Larry Brasfield (larrybr) on 2021-05-31 14:43:36 in reply to 1 [source]

The only time those 4 functions are omitted when the other math functions are included is when (1) the MSVC compiler is used and (2) it is a very old version of the compiler, or (3) somebody perversely predefines MSVC_VERSION to mimic conditions 1 and 2.

For modern or semi-modern compilers not meeting that condition, the SQLITE_HAVE_C99_MATH_FUNCS macro has little significance. I do not see doc silence on it as a deficiency.

I am curious as to how you happened to encounter this. Are you using a very old (pre-C99) compiler? Did you see compilation or link errors due to this? Or is it just a curiosity to you?

(3) By anonymous on 2021-05-31 15:44:48 in reply to 2 [link] [source]

You're right, of course. After further study I see that SQLITE_HAVE_C99_MATH_FUNCS is an implementation detail. I misread/misunderstood the checks for the value of MSVC_VERSION related to SQLITE_HAVE_C99_MATH_FUNCS.