Section courante

A propos

Section administrative du site

EXP

Exposant
Langage C math.h

Syntaxe

double exp(double n);

Paramètres

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

Description

Cette fonction calcul l'exponentiel de la valeur «x».

Remarque

Algorithme

MODULE EXP(x)
   Inverse ← faux
   n ← 0
   dl ← 1
   i ← 1
   SI x < 0 ALORS
      Inverse ← vrai
      x ← -x
   FIN SI
   BOUCLE FAIRE TANT QUE x >= 2
      xx / 2
      nn + 1
   FIN BOUCLE FAIRE TANT QUE
   xx / 16
   nn + 4
   qx
   BOUCLE FAIRE TANT QUE q > 1.0E - 15
      dldl + q
      ii + 1
      qq x x / i
   FIN BOUCLE FAIRE TANT QUE
   BOUCLE POUR i ← 1 JUSQU'A n
      dldl x dl
   FIN BOUCLE POUR
   SI Inverse ALORS
      dl ← 1 / dl
   FIN SI
   RETOURNE dl

Exemple

Voici un exemple permet d'afficher les exposants inférieurs à 2 :

Essayer maintenant !
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int main()
  6. {
  7.     float I;
  8.     for(I = 0;I <= 2.0;I += 0.1) {
  9.         printf("Exp(%f)=%f\n",I,exp(I));
  10.     }
  11.     return 0;
  12. }

on obtiendra le résultat suivant :

Exp(0.000000)=1.000000
Exp(0.100000)=1.105171
Exp(0.200000)=1.221403
Exp(0.300000)=1.349859
Exp(0.400000)=1.491825
Exp(0.500000)=1.648721
Exp(0.600000)=1.822119
Exp(0.700000)=2.013753
Exp(0.800000)=2.225541
Exp(0.900000)=2.459603
Exp(1.000000)=2.718282
Exp(1.100000)=3.004166
Exp(1.200000)=3.320117
Exp(1.300000)=3.669297
Exp(1.400000)=4.055201
Exp(1.500000)=4.481690
Exp(1.600000)=4.953034
Exp(1.700000)=5.473949
Exp(1.800000)=6.049649
Exp(1.900000)=6.685897

Voir également

Langage de programmation - C - Référence procédures et fonctions - log
Langage de programmation - C - Référence procédures et fonctions - pow
Langage de programmation - C - Référence procédures et fonctions - sqrt
Langage de programmation - C++ - Référence procédures et fonctions - exp

Références

Langage C, Edition Micro-Application, Gehard Willms, 2001, ISBN: 2-7429-2008-0, page 731.
Borland C++ for Windows 4.0, Library Reference, Edition Borland, 1993, Part # BCP1240WW21772, page 90.

Dernière mise à jour : Mardi, le 28 juillet 2015