LOG10 |
Logarithme en base 10 |
---|---|
MySQL |
Syntaxe
Log10(Nombre) |
Paramètres
Nom | Description |
---|---|
Nombre | Ce paramètre permet d'indiquer l'expression contenant le nombre à traiter |
Description
Cette fonction retourne le logarithme de la base 10.
Algorithme
MODULE SQRT(X) SI X = 0.0 ALORS RETOURNE 0.0 SINON M ← 1.0 XN ← X BOUCLE FAIRE TANT QUE XN >= 2.0 XN ← 0.25 x XN M ← 2.0 x M FIN BOUCLE FAIRE TANT QUE BOUCLE FAIRE TANT QUE XN < 0.5 XN ← 4.0 x XN M ← 0.5 x M FIN BOUCLE FAIRE TANT QUE A ← XN B ← 1.0 - XN BOUCLE REPETER A ← A x (1.0 + 0.5 x B) B ← 0.25 x (3.0 + B) x B x B FIN BOUCLE JUSQU'A B ← 1.0E - 15 RETOURNE A x M FIN SI MODULE LOG(x) negatif ← faux fois ← 1 ajout ← 0 SI x <= 0.0 ALORS RETOURNE 0 FIN SI SI x < 1.0 ALORS negatif ← vrai x ← 1.0 / x FIN SI BOUCLE FAIRE TANT QUE x >= 10.0 x ← x / 10.0 ajout ← ajout + 2.302585092994046 FIN BOUCLE FAIRE TANT QUE BOUCLE FAIRE TANT QUE x >= 1.1 x ← SQRT(x) fois ← fois x 2 FIN BOUCLE FAIRE TANT QUE x ← x - 1 savx ← x i ← 2 xp ← x x x quotient ← (xp / i) dl ← x - quotient BOUCLE FAIRE TANT QUE 1.0E-15 ← quotient i ← i + 1 xp ← xp x x dl ← dl + (xp / i) i ← i + 1 xp ← xp x x quotient ← (xp / i) dl ← dl - quotient FIN BOUCLE FAIRE TANT QUE dl ← dl x fois dl ← dl + ajout SI negatif ALORS dl ← -dl FIN SI RETOURNE dl MODULE LOG10(DansNombre) RETOURNE LOG(DansNombre) / 2,3025850930 |
Exemple
Voici un exemple permet d'afficher les logarithmes 10 inférieurs à 2 :
on obtiendra le résultat suivant :
+----------------------------------+| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| NULL |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(0.1)=-1 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(0.2)=-0.698970004336019 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(0.3)=-0.522878745280338 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(0.4)=-0.397940008672038 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(0.5)=-0.301029995663981 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(0.6)=-0.221848749616356 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(0.7)=-0.154901959985743 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(0.8)=-0.0969100130080564 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(0.9)=-0.0457574905606752 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(1)=-4.82163733276644e-017 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(1.1)=0.041392685158225 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(1.2)=0.0791812460476248 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(1.3)=0.113943352306837 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(1.4)=0.146128035678238 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(1.5)=0.176091259055681 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(1.6)=0.204119982655925 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(1.7)=0.230448921378274 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(1.8)=0.255272505103306 |
+----------------------------------+
+----------------------------------+
| CONCAT("Log10(",R,")=",log10(R)) |
+----------------------------------+
| Log10(1.9)=0.278753600952829 |
+----------------------------------+
Voir également
Article - Les géants de l'informatique - Oracle
Références
MySQL - Référence, Edition Micro Application, Nicolas Rivereau, Antoine Pichot, 2002, ISBN: 2-7429-2560-0, page 927.
MySQL: The definitive guide to using, programming, and administering MySQL 4 databases - Second Edition, Paul Dubois, 2003, ISBN: 0-7357-1212-3, page 806
Dernière mise à jour : Mercredi, le 29 avril 2015