计算x的平方根的倒数。
C interface:
float invsqrtf(float x);
double invsqrt(double x);
long double invsqrtl(long double x);
Fortran interface:
RES = SQRTF(X);
RES = SQRT(X);
参数名 |
类型 |
描述 |
输入/输出 |
---|---|---|---|
x |
|
表示输入数据的浮点值。 |
输入 |
C: "km.h"
C interface:
// typical usage double x1 = 1.0, x2 = 2.0, x3 = 3.0, x4 = 4.0; // special handing double a = 0.0, b = INFINITY, c = -INFINITY, d = NAN; // print result printf("invsqrt(1.0) = %.15f\n", invsqrt(x1)); printf("invsqrt(2.0) = %.15f\n", invsqrt(x2)); printf("invsqrt(3.0) = %.15f\n", invsqrt(x3)); printf("invsqrt(4.0) = %.15f\n", invsqrt(x4)); printf("invsqrt(0.0) = %.15f\n", invsqrt(a)); printf("invsqrt(INFINITY) = %.15f\n", invsqrt(b)); printf("invsqrt(-INFINITY) = %.15f\n", invsqrt(c)); printf("invsqrt(NAN) = %.15f\n", invsqrt(d)); /* * invsqrt(1.0) = 1.000000000000000 * invsqrt(2.0) = 0.707106781186548 * invsqrt(3.0) = 0.577350269189626 * invsqrt(4.0) = 0.500000000000000 * invsqrt(0.0) = inf * invsqrt(INFINITY) = 0.000000000000000 * invsqrt(-INFINITY) = nan * invsqrt(NAN) = nan * */