exp () , expf () , expl ()-计算指数函数

标准

标准/扩展 C 或 C++ 依赖关系
ISO C
POSIX.1
XPG4
XPG4.2
ISO/ANSI C++
C99
单一 UNIX 规范 V 3
C++ TR1 C99
两个  

格式

#include <math.h>

double exp(double x);
float exp(float x);                  /* C++ only */
long double exp(long double x);      /* C++ only */
float expf(float x);
long double expl(long double x);

一般描述

计算 x的指数,定义为 Start of changeexEnd of change,其中 e 等于 更改开始2.718281828更改结束....
注: 这些函数同时适用于 IEEE 二进制浮点和十六进制浮点格式。 有关 IEEE 二进制浮点的更多信息,请参阅 IEEE 二进制浮点

返回值

如果成功,该函数将返回计算值。

如果发生溢出,那么此函数将返回 HUGE_VAL。 如果发生下溢,那么将返回 0。 溢出和下流都将 errno 设置为 ERANGE。

示例

CELEBE06
/* CELEBE06                                      

   This example calculates y as the exponential function of x.                  
                                                                                
 */                                                                             
#include <math.h>                                                               
#include <stdio.h>                                                              
                                                                                
int main(void)                                                                  
{                                                                               
   double x, y;                                                                 
                                                                                
   x = 5.0;                                                                     
   y = exp(x);                                                                  
                                                                                
   printf("exp( %f ) = %f\n", x, y);                                            
}                                                                               
output
exp( 5.000000 ) = 148.413159

相关信息