Стандарт языка Си С99 TC (1113411), страница 43
Текст из файла (страница 43)
A rangeerror occurs if x is too large.208)Returns3The expm1 functions return ex − 1.7.12.6.4 The frexp functionsSynopsis1#include <math.h>double frexp(double value, int *exp);float frexpf(float value, int *exp);long double frexpl(long double value, int *exp);Description2The frexp functions break a floating-point number into a normalized fraction and anintegral power of 2.
They store the integer in the int object pointed to by exp.Returns3If value is not a floating-point number, the results are unspecified. Otherwise, thefrexp functions return the value x, such that x has a magnitude in the interval [1/2, 1) orzero, and value equals x × 2*exp . If value is zero, both parts of the result are zero.7.12.6.5 The ilogb functionsSynopsis1#include <math.h>int ilogb(double x);int ilogbf(float x);int ilogbl(long double x);Description2The ilogb functions extract the exponent of x as a signed int value. If x is zero theycompute the value FP_ILOGB0; if x is infinite they compute the value INT_MAX; if x isa NaN they compute the value FP_ILOGBNAN; otherwise, they are equivalent to callingthe corresponding logb function and casting the returned value to type int.
A domainerror or range error may occur if x is zero, infinite, or NaN. If the correct value is outsidethe range of the return type, the numeric result is unspecified.208) For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1.224Library§7.12.6.5WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3Returns3The ilogb functions return the exponent of x as a signed int value.Forward references: the logb functions (7.12.6.11).7.12.6.6 The ldexp functionsSynopsis1#include <math.h>double ldexp(double x, int exp);float ldexpf(float x, int exp);long double ldexpl(long double x, int exp);Description2The ldexp functions multiply a floating-point number by an integral power of 2.
Arange error may occur.Returns3The ldexp functions return x × 2exp .7.12.6.7 The log functionsSynopsis1#include <math.h>double log(double x);float logf(float x);long double logl(long double x);Description2The log functions compute the base-e (natural) logarithm of x. A domain error occurs ifthe argument is negative. A range error may occur if the argument is zero.Returns3The log functions return loge x.7.12.6.8 The log10 functionsSynopsis1#include <math.h>double log10(double x);float log10f(float x);long double log10l(long double x);§7.12.6.8Library225ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256Description2The log10 functions compute the base-10 (common) logarithm of x. A domain erroroccurs if the argument is negative. A range error may occur if the argument is zero.Returns3The log10 functions return log10 x.7.12.6.9 The log1p functionsSynopsis1#include <math.h>double log1p(double x);float log1pf(float x);long double log1pl(long double x);Description2The log1p functions compute the base-e (natural) logarithm of 1 plus the argument.209)A domain error occurs if the argument is less than −1.
A range error may occur if theargument equals −1.Returns3The log1p functions return loge (1 + x).7.12.6.10 The log2 functionsSynopsis1#include <math.h>double log2(double x);float log2f(float x);long double log2l(long double x);Description2The log2 functions compute the base-2 logarithm of x. A domain error occurs if theargument is less than zero. A range error may occur if the argument is zero.Returns3The log2 functions return log2 x.209) For small magnitude x, log1p(x) is expected to be more accurate than log(1 + x).226Library§7.12.6.10WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.12.6.11 The logb functionsSynopsis1#include <math.h>double logb(double x);float logbf(float x);long double logbl(long double x);Description2The logb functions extract the exponent of x, as a signed integer value in floating-pointformat. If x is subnormal it is treated as though it were normalized; thus, for positivefinite x,1 ≤ x × FLT_RADIX−logb(x) < FLT_RADIXA domain error or range error may occur if the argument is zero.Returns3The logb functions return the signed exponent of x.7.12.6.12 The modf functionsSynopsis1#include <math.h>double modf(double value, double *iptr);float modff(float value, float *iptr);long double modfl(long double value, long double *iptr);Description2The modf functions break the argument value into integral and fractional parts, each ofwhich has the same type and sign as the argument.
They store the integral part (infloating-point format) in the object pointed to by iptr.Returns3The modf functions return the signed fractional part of value.§7.12.6.12Library227ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N12567.12.6.13 The scalbn and scalbln functionsSynopsis1#include <math.h>double scalbn(double x, int n);float scalbnf(float x, int n);long double scalbnl(long double x, int n);double scalbln(double x, long int n);float scalblnf(float x, long int n);long double scalblnl(long double x, long int n);Description2The scalbn and scalbln functions compute x × FLT_RADIXn efficiently, notnormally by computing FLT_RADIXn explicitly.
A range error may occur.Returns3The scalbn and scalbln functions return x × FLT_RADIXn .7.12.7 Power and absolute-value functions7.12.7.1 The cbrt functionsSynopsis1#include <math.h>double cbrt(double x);float cbrtf(float x);long double cbrtl(long double x);Description2The cbrt functions compute the real cube root of x.Returns3The cbrt functions return x1/3 .7.12.7.2 The fabs functionsSynopsis1#include <math.h>double fabs(double x);float fabsf(float x);long double fabsl(long double x);Description2The fabs functions compute the absolute value of a floating-point number x.228Library§7.12.7.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3Returns3The fabs functions return | x |.7.12.7.3 The hypot functionsSynopsis1#include <math.h>double hypot(double x, double y);float hypotf(float x, float y);long double hypotl(long double x, long double y);Description2The hypot functions compute the square root of the sum of the squares of x and y,without undue overflow or underflow.
A range error may occur.3Returns4The hypot functions return √x2 + y2 .7.12.7.4 The pow functionsSynopsis1#include <math.h>double pow(double x, double y);float powf(float x, float y);long double powl(long double x, long double y);Description2The pow functions compute x raised to the power y. A domain error occurs if x is finiteand negative and y is finite and not an integer value. A range error may occur. A domainerror may occur if x is zero and y is zero. A domain error or range error may occur if xis zero and y is less than zero.Returns3The pow functions return xy .7.12.7.5 The sqrt functionsSynopsis1#include <math.h>double sqrt(double x);float sqrtf(float x);long double sqrtl(long double x);§7.12.7.5Library229ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256Description2The sqrt functions compute the nonnegative square root of x.
A domain error occurs ifthe argument is less than zero.Returns3The sqrt functions return √x.7.12.8 Error and gamma functions7.12.8.1 The erf functionsSynopsis1#include <math.h>double erf(double x);float erff(float x);long double erfl(long double x);Description2The erf functions compute the error function of x.Returns3The erf functions return erf x =2π√∫x0e−t dt.27.12.8.2 The erfc functionsSynopsis1#include <math.h>double erfc(double x);float erfcf(float x);long double erfcl(long double x);Description2The erfc functions compute the complementary error function of x. A range erroroccurs if x is too large.Returns3The erfc functions return erfc x = 1 − erf x =2302π√Library∫∞xe−t dt.2§7.12.8.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC37.12.8.3 The lgamma functionsSynopsis1#include <math.h>double lgamma(double x);float lgammaf(float x);long double lgammal(long double x);Description2The lgamma functions compute the natural logarithm of the absolute value of gamma ofx.
A range error occurs if x is too large. A range error may occur if x is a negativeinteger or zero.Returns3The lgamma functions return loge | Γ(x) |.7.12.8.4 The tgamma functionsSynopsis1#include <math.h>double tgamma(double x);float tgammaf(float x);long double tgammal(long double x);Description2The tgamma functions compute the gamma function of x. A domain error or range errormay occur if x is a negative integer or zero. A range error may occur if the magnitude ofx is too large or too small.Returns3The tgamma functions return Γ(x).7.12.9 Nearest integer functions7.12.9.1 The ceil functionsSynopsis1#include <math.h>double ceil(double x);float ceilf(float x);long double ceill(long double x);Description2The ceil functions compute the smallest integer value not less than x.§7.12.9.1Library231ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256Returns3The ceil functions return x, expressed as a floating-point number.7.12.9.2 The floor functionsSynopsis1#include <math.h>double floor(double x);float floorf(float x);long double floorl(long double x);Description2The floor functions compute the largest integer value not greater than x.Returns3The floor functions return x, expressed as a floating-point number.7.12.9.3 The nearbyint functionsSynopsis1#include <math.h>double nearbyint(double x);float nearbyintf(float x);long double nearbyintl(long double x);Description2The nearbyint functions round their argument to an integer value in floating-pointformat, using the current rounding direction and without raising the ‘‘inexact’’ floatingpoint exception.Returns3The nearbyint functions return the rounded integer value.7.12.9.4 The rint functionsSynopsis1#include <math.h>double rint(double x);float rintf(float x);long double rintl(long double x);Description2The rint functions differ from the nearbyint functions (7.12.9.3) only in that therint functions may raise the ‘‘inexact’’ floating-point exception if the result differs invalue from the argument.232Library§7.12.9.4WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3Returns3The rint functions return the rounded integer value.7.12.9.5 The lrint and llrint functionsSynopsis1#include <math.h>long int lrint(double x);long int lrintf(float x);long int lrintl(long double x);long long int llrint(double x);long long int llrintf(float x);long long int llrintl(long double x);Description2The lrint and llrint functions round their argument to the nearest integer value,rounding according to the current rounding direction.