Fonctions numériques#
courant
| Fonction | Description | |
|---|---|---|
ROUND(x, n) |
Arrondi à n décimales | essentiel |
ABS(x) |
Valeur absolue | courant |
x % y |
Reste (alias MOD(x, y)) |
courant |
RANDOM() |
Entier aléatoire signé 64 bits | courant |
CEIL(x) / CEILING(x) |
Arrondi supérieur | courant |
FLOOR(x) |
Arrondi inférieur | courant |
POWER(x, y) |
x puissance y | avancé |
SQRT(x) |
Racine carrée | avancé |
EXP(x) |
Exponentielle | avancé |
LN(x) / LOG(x) |
Logarithme naturel / base 10 | avancé |
LOG(b, x) |
Logarithme base b | avancé |
PI() |
π | avancé |
SIGN(x) |
Signe (-1, 0, 1) | avancé |
RANDOMBLOB(n) |
n octets aléatoires | avancé |
Exemples#
SELECT ROUND(3.14159, 2); -- 3.14
SELECT ABS(-5); -- 5
SELECT 10 % 3; -- 1
SELECT SQRT(16.0); -- 4.0
SQLite
Seuls ABS, ROUND, RANDOM, RANDOMBLOB et l'opérateur % sont toujours disponibles. POWER, LOG, LN, EXP, SQRT, PI, CEIL, FLOOR, SIGN, MOD proviennent de l'extension mathématique intégrée (≥ 3.35, activée par défaut dans la plupart des builds récents mais pas tous).