標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
ISO C |
両方 |
#include <math.h>
double log10(double x);
float log10(float x); /* C++ only */
long double log10(long double x); /* C++ only */
float log10f(float x);
long double log10l(long double x);
計算値を戻します。
x が負の場合、関数は errno を EDOM に設定し、-HUGE_VAL を戻します。x が 0 の場合、関数は -HUGE_VAL を戻し、errno に ERANGE を設定します。正しい値がアンダーフローの原因になった場合には、0 が戻され、ERANGE の値が errno に保管されます。
IEEE の特殊な動作: 正常に実行された場合、関数は、x の正の値の 10 を基数とする対数を戻します。
⁄* CELEBL09
This example calculates the base 10 logarithm of 1000.0.
*⁄
#include <math.h>
#include <stdio.h>
int main(void)
{
double x = 1000.0, y;
y = log10(x);
printf("The base 10 logarithm of %lf is %lf¥n", x, y);
}
The base 10 logarithm of 1000.000000 is 3.000000