Skip to main content
The math functions are not SQLite’s own built-in math functions. They come from a bundled extension that mirrors most of that set, with a few differences that matter when porting SQL.
  • log(x) is the natural logarithm. Use log10(x) for base 10. The two-argument form log(base, x) and log2(x) are not available.
  • ceil(), ceiling(), and floor() return an integer rather than a real.
  • power(x, y) is available, but pow(), trunc(), and mod() are not.

Functions

Edge cases

sqrt() of a negative number returns NULL. Other domain errors, such as acos(2) or log(-1), raise an error. ln(0) raises an error.
Last modified on November 2, 2026