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
| Function | SQLite | MySQL | ClickHouse | PostgreSQL | Notes |
|---|---|---|---|---|---|
abs() | ✅ | ✅ | ✅ | ✅ | |
ceiling() | ✅ | ✅ | ✅ | ✅ | ceil() |
floor() | ✅ | ✅ | ✅ | ✅ | |
round() | ✅ | ✅ | ✅ | ✅ | |
sqrt() | ✅ | ✅ | ✅ | ✅ | |
pow() | ✅ | ✅ | ✅ | ✅ | |
exp() | ✅ | ✅ | ✅ | ✅ | |
log() | ✅ | ✅ | ✅ | ✅ | Two-arg form: ln(x)/ln(base) |
log10() | ✅ | ✅ | ✅ | ✅ | |
log2() | ✅ | ✅ | ✅ | ✅ | |
pi() | ✅ | ✅ | ✅ | ✅ | |
rand() | ✅ | ✅ | ✅ | ✅ | random() in SQLite/Postgres |
cos(), sin(), tan() | ✅ | ✅ | ✅ | ✅ | |
acos(), asin(), atan(), atan2() | ✅ | ✅ | ✅ | ✅ | |
sign() | ✅ | ✅ | ✅ | ✅ | |
max_of() | ✅ | ✅ | ✅ | ✅ | greatest() |
min_of() | ✅ | ✅ | ✅ | ✅ | least() |
gamma() | ❌ | ❌ | ✅ | ✅ | |
loggamma() | ❌ | ❌ | ✅ | ❌ | ClickHouse: lgamma() |
beta_cdf(), gamma_cdf() | ❌ | ❌ | ❌ | ❌ | Not implemented |
isfinite() | ❌ | ❌ | ✅ | ✅ | |
isinf() | ⚠️ | ⚠️ | ✅ | ✅ | Postgres: val = 'infinity' OR val = '-infinity'; MySQL: ABS(val) > 1e308 with warning; SQLite: unsupported with warning |
isnan() | ❌ | ❌ | ✅ | ✅ |