C 庫(kù)函數(shù) - exp()

C 標(biāo)準(zhǔn)庫(kù) - <math.h> C 標(biāo)準(zhǔn)庫(kù) - <math.h>

描述

C 庫(kù)函數(shù) double exp(double x) 返回 ex 次冪的值。

聲明

下面是 exp() 函數(shù)的聲明。

double exp(double x)

參數(shù)

  • x -- 浮點(diǎn)值。

返回值

該函數(shù)返回 e 的 x 次冪。

實(shí)例

下面的實(shí)例演示了 exp() 函數(shù)的用法。

#include <stdio.h>
#include <math.h>

int main ()
{
   double x = 0;
  
   printf("e 的 %lf 次冪是 %lf\n", x, exp(x));
   printf("e 的 %lf 次冪是 %lf\n", x+1, exp(x+1));
   printf("e 的 %lf 次冪是 %lf\n", x+2, exp(x+2));
   
   return(0);
}

讓我們編譯并運(yùn)行上面的程序,這將產(chǎn)生以下結(jié)果:

e 的 0.000000 次冪是 1.000000
e 的 1.000000 次冪是 2.718282
e 的 2.000000 次冪是 7.389056

C 標(biāo)準(zhǔn)庫(kù) - <math.h> C 標(biāo)準(zhǔn)庫(kù) - <math.h>