exp ()- 计算指数函数

格式

#include <math.h>
double exp(double x);

语言级别

ANSI

线程安全

描述

exp() 函数计算浮点自变量 x ( ex ,其中 e 等于 2.17128128...) 的指数值。

返回值

如果发生溢出, exp() 函数将返回 HUGE_VAL。 如果发生下流,那么它将返回 0。 溢出和下溢都将 errno 设置为 ERANGE。 errno 的值也可以设置为 EDOM。

示例

此示例将 y 计算为 x的指数函数:
#include <math.h>
#include <stdio.h>
 
int main(void)
{
   double x, y;
 
   x = 5.0;
   y = exp(x);
 
   printf("exp( %lf ) = %lf\n", x, y);
}
 
/*****************  Output should be similar to:  *****************
 
exp( 5.000000 ) = 148.413159
*/

相关信息