SQLite Forum

Native math function support for SQLite
Login
I answer for 3-4 reasons which may be inferred from what follows.

The 'Lite' part of SQLite is part of what contributes to its ubiquity on smaller devices.  Having the extension mechanism in place is a great solution to the tension between 'Lite' and full-featured. Of course, it could never be full-featured for every application because there is a practically infinite set of functions that might be useful across the large set of SQLite applications.

It is close to child's play for a developer to add functions to SQLite which, for a given build, act just as if they were 'natively supported'.  Since you apparently are not a developer, (because you ask for somebody else to add what you could easily add yourself if you were), I suggest that you ask a developer friend or favor-debtor to look at the code, 'shell.c', that is included in the distributions and point out what parts to emulate so that your favored math functions can be added in a near-native way (as far as you will be able tell).

I wonder, when you opine that those transcendental math functions "should be natively supported by SQLite', whether you are aware that SQLite is used on machines which do not have hardware support for floating point arithmetic. Does that fact affect your "should" thinking?

Finally, in addition to some lecturing, a few tips: Take a look at [SpatiaLite](https://www.gaia-gis.it/fossil/libspatialite/index) and see if that is not closer to what you seem to believe SQLite should be. However, if it is, be careful to not begrudge its departure from lightness relative to SQLite. Or, if you prefer the sqlite3 shell as it is, except with a few more math functions you value, consider putting something like

```
alias sqlite3_math=sqlite3 -cmd ".load sqlmath"
```

in your shell's startup script. Or, if you have a mess of customizations, (or favor a shell incapable of 'alias' or equivalent), put something like

```
.load sqlmath
.load fileio
.load noop
.mode tabs
```

into a file named '.sqliterc' located in your home directory, to be read whenever you invoke the sqlite3 shell.