frexp,frexpl

提供: RAD Studio
移動先: 案内検索

math.h:インデックス への移動


ヘッダーファイル

math.h

カテゴリ

演算ルーチン

プロトタイプ

double frexp(double x, int *exponent);

long double frexpl(long double x, int *exponent);

説明

数値を仮数部と指数部に分割します。

frexp は,x = m * 2^n(x は元の double 値)になる仮数部 m(0.5 以上 1 未満の double)と整数値 n を計算します。frexp は,exponent が指す整数に n を格納します。

frexpl は long double バージョンです。long double 引数 x を受け取り,long double の結果を返します。

戻り値

frexp および frexpl は,仮数部 m を返します。これらのルーチンのエラー処理は,関数 _matherr および _matherrl を使って変更できます。



 #include <math.h>
 #include <stdio.h>
 int main(void)
 {
    double mantissa, number;
    int exponent;
    number = 8.0;
    mantissa = frexp(number, &exponent);
    printf("The number %lf is ", number);
    printf("%lf times two to the ", mantissa);
    printf("power of %d\n", exponent);
    return 0;
 }



移植性



POSIX Win32 ANSI C ANSI C++

frexp

+

+

+

+

frexpl

+

+

+