Section courante

A propos

Section administrative du site

LOG

Logarithme
Sybase  

Syntaxe

Log(Nombre)

Paramètres

Nom Description
Nombre Ce paramètre permet d'indiquer l'expression contenant le nombre à traiter

Description

Cette fonction retourne le logarithme naturel (base e).

Algorithme

MODULE SQRT(X)
   SI X = 0.0 ALORS
      RETOURNE 0.0
   SINON
      M ← 1.0
      XNX
      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
      AXN
      B ← 1.0 - XN
      BOUCLE REPETER
         AA 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
      xx / 10.0
      ajoutajout + 2.302585092994046
   FIN BOUCLE FAIRE TANT QUE
   BOUCLE FAIRE TANT QUE x >= 1.1
      x ← SQRT(x)
      foisfois x 2
   FIN BOUCLE FAIRE TANT QUE
   xx - 1
   savxx
   i ← 2
   xpx x x
   quotient ← (xp / i)
   dlx - quotient
   BOUCLE FAIRE TANT QUE 1.0E-15 ← quotient
      ii + 1
      xpxp x x
      dldl + (xp / i)
      ii + 1
      xpxp x x
      quotient ← (xp / i)
      dldl - quotient
   FIN BOUCLE FAIRE TANT QUE
   dldl x fois
   dldl + ajout
   SI negatif ALORS
      dl ← -dl
   FIN SI
   RETOURNE dl

Voir également

Langage de programmation - Sybase - Référence de fonctions - LOG10
Langage de programmation - Sybase - Référence de fonctions - POWER

Dernière mise à jour : Dimanche, le 31 mai 2015