トップページ > キーワード検索 > exp()
C言語規格
C言語(その他)
プログラム
その他
exp()
機能 ネイピア数(e)を底とするxの累乗(ex)を計算することを表す。

引数の絶対値が大きすぎる場合は値域エラー(ERANGE)が発生する。
※ e = 2.71828…
定義 #include <math.h>

double exp ( double x );
float exp ( float x );
long double exp ( long double x );

※C99規格では以下の定義となる
double exp ( double x );
float expf ( float x );
long double expl ( long double x );
引数
x指数
戻り値 計算結果を返す。
実装例
#include <math.h>
#include <stdio.h>

int main(void)
{
    double a = 2.0;
    
    printf("exp(%f) = %f\n", a, exp(a) );  /* e^2 */

    return 0;
}
実行結果
exp(2.000000) = 7.389056





inserted by FC2 system