SQLite Forum

New SQLITE_ENABLE_MATH_FUNCTIONS
Login

New SQLITE_ENABLE_MATH_FUNCTIONS

(1) By Keith Medcalf (kmedcalf) on 2020-12-08 21:43:05 [link] [source]

Nice. I have the following functions which are not yet included in func.c:

_chgsign,
fabs,
_j0,
_j1,
_y0,
_y1,
_copysign,
_hypot,
_jn,
_yn,
ldexp,
_mantissa, (mantissa part of frexp, the inverse of ldexp)
_exponent, (exponent part of frexp, the inverse of ldexp)
_fracpart, (opposite of "trunc", return the fractional part, from modf)

The implementation of the rest seems to be pretty much the same as how I did it except that I implemented "trunc" by returning the intpart from modf ...

(2) By Richard Hipp (drh) on 2020-12-08 22:57:00 in reply to 1 [source]

I was going off of what is supported in PostgreSQL, SQL Server, and MySQL, not what is supported by libm.a.

(3) By Keith Medcalf (kmedcalf) on 2020-12-08 23:52:37 in reply to 2 [link] [source]

I completely understand. Just pointing out that there is actually very little implemented in libm (and the MSVC runtime) that you have not implemented. I don't really know the utility of adding these additional functions, however, as far as I know they are actually available in the math libraries that support the other functions.

(4) By Warren Young (wyoung) on 2020-12-09 00:23:34 in reply to 1 [link] [source]

(5) By Richard Hipp (drh) on 2020-12-09 00:50:11 in reply to 4 [link] [source]

I can implement abs() without the help of libm.a.

(6) By ddevienne on 2020-12-09 09:06:38 in reply to 5 [link] [source]

Hi Richard. Is there doc somewhere (link?) on the R-23979-26855-like
implementation notes (constraints?) sprinkled in the code?

Could you please share some info if not? Like the format used,
how they are processed or gathered or checked, etc... TIA

(8) By Richard Hipp (drh) on 2020-12-09 12:15:48 in reply to 6 [link] [source]

Some parts of the documentation are identified as "requirements". Sentences or phrases of the documentation that are intended to be a requirement are enclosed within ^(...)^ or from a single ^ to the next .. The requirement number is derived from the text of the requirement (after normalizing by removing surplus whitespace and HTML markup). The requirement number is the MD5 checksum of the normalized requirement text expressed as:

R-N-N-N-N-N-N-N-N

Where each N is a number between 00000 and 65535. Any unique prefix is acceptable as a requirement name.

Comments in the code that indicate that part of the code implements or proves a requirement normally reference the requirement number, rather than the complete text of the requirement, for brevity.

(9) By Warren Young (wyoung) on 2020-12-09 15:49:52 in reply to 8 [link] [source]

Is there a requirements index?

Is there a tool that will take a requirement identifier and produce a doc link?

(7) By ddevienne on 2020-12-09 09:08:50 in reply to 1 [link] [source]

For posterity, DRH's checkin: https://www.sqlite.org/src/info/6b93627b5d9819ab