Skip to main content

Scalar Functions — Math

Math functions cover standard arithmetic, trigonometry, logarithms, rounding, and numeric utility functions. Most are universally supported. The main gaps are statistical functions like gamma() and loggamma(), and float inspection functions like isnan() and isfinite(), which are unavailable in SQLite.

Legend: ✅ Supported · ⚠️ Approximated · ❌ Not Supported · 🔄 Rewritten

FunctionSQLiteMySQLClickHousePostgreSQLDuckDBNotes
abs()
ceiling()ceil()
floor()
round()
sqrt()
pow()
exp()
log()Two-arg form: ln(x)/ln(base)
log10()
log2()
pi()
rand()random() in SQLite/Postgres/DuckDB
cos(), sin(), tan()
acos(), asin(), atan(), atan2()
sign()
max_of()greatest()
min_of()least()
gamma()
loggamma()ClickHouse & DuckDB: lgamma()
beta_cdf(), gamma_cdf()Not implemented
isfinite()
isinf()⚠️SQLite: exact ABS(val) > DBL_MAX; MySQL: ABS(val) > 1e308 (approximated, warns); Postgres: val = 'infinity' OR val = '-infinity'; DuckDB: isinf()
isnan()