@comment math.h
@comment BSD
@deftypefun int isinf (double @var{x})
+@comment math.h
+@comment BSD
@deftypefunx int isinff (float @var{x})
+@comment math.h
+@comment BSD
@deftypefunx int isinfl (long double @var{x})
This function returns @code{-1} if @var{x} represents negative infinity,
@code{1} if @var{x} represents positive infinity, and @code{0} otherwise.
@comment math.h
@comment BSD
@deftypefun int isnan (double @var{x})
+@comment math.h
+@comment BSD
@deftypefunx int isnanf (float @var{x})
+@comment math.h
+@comment BSD
@deftypefunx int isnanl (long double @var{x})
This function returns a nonzero value if @var{x} is a ``not a number''
value, and zero otherwise.
@comment math.h
@comment BSD
@deftypefun int finite (double @var{x})
+@comment math.h
+@comment BSD
@deftypefunx int finitef (float @var{x})
+@comment math.h
+@comment BSD
@deftypefunx int finitel (long double @var{x})
This function returns a nonzero value if @var{x} is finite or a ``not a
number'' value, and zero otherwise.
Alternatively, you can enable @dfn{traps} for exceptions. In that case,
when an exception is raised, your program will receive the @code{SIGFPE}
signal. The default action for this signal is to terminate the
-program. @xref{Signal Handling} for how you can change the effect of
+program. @xref{Signal Handling}, for how you can change the effect of
the signal.
@findex matherr
@comment math.h
@comment ISO
@deftypevr Macro double HUGE_VAL
+@comment math.h
+@comment ISO
@deftypevrx Macro float HUGE_VALF
+@comment math.h
+@comment ISO
@deftypevrx Macro {long double} HUGE_VALL
An expression representing a particular very large number. On machines
that use @w{IEEE 754} floating point format, @code{HUGE_VAL} is infinity.
@pindex math.h
@pindex stdlib.h
Prototypes for @code{abs}, @code{labs} and @code{llabs} are in @file{stdlib.h};
+@code{imaxabs} is declared in @file{inttypes.h};
@code{fabs}, @code{fabsf} and @code{fabsl} are declared in @file{math.h}.
@code{cabs}, @code{cabsf} and @code{cabsl} are declared in @file{complex.h}.
@comment stdlib.h
@comment ISO
@deftypefun int abs (int @var{number})
+@comment stdlib.h
+@comment ISO
@deftypefunx {long int} labs (long int @var{number})
+@comment stdlib.h
+@comment ISO
@deftypefunx {long long int} llabs (long long int @var{number})
+@comment inttypes.h
+@comment ISO
+@deftypefunx intmax_t imaxabs (intmax_t @var{number})
These functions return the absolute value of @var{number}.
Most computers use a two's complement integer representation, in which
the absolute value of @code{INT_MIN} (the smallest possible @code{int})
cannot be represented; thus, @w{@code{abs (INT_MIN)}} is not defined.
-@code{llabs} is new to @w{ISO C 9x}
+@code{llabs} and @code{imaxdiv} are new to @w{ISO C 9x}.
@end deftypefun
@comment math.h
@comment ISO
@deftypefun double fabs (double @var{number})
+@comment math.h
+@comment ISO
@deftypefunx float fabsf (float @var{number})
+@comment math.h
+@comment ISO
@deftypefunx {long double} fabsl (long double @var{number})
This function returns the absolute value of the floating-point number
@var{number}.
@comment complex.h
@comment ISO
@deftypefun double cabs (complex double @var{z})
+@comment complex.h
+@comment ISO
@deftypefunx float cabsf (complex float @var{z})
+@comment complex.h
+@comment ISO
@deftypefunx {long double} cabsl (complex long double @var{z})
These functions return the absolute value of the complex number @var{z}
(@pxref{Complex Numbers}). The absolute value of a complex number is:
This function should always be used instead of the direct formula
because it takes special care to avoid losing precision. It may also
take advantage of hardware support for this operation. See @code{hypot}
-in @xref{Exponents and Logarithms}.
+in @ref{Exponents and Logarithms}.
@end deftypefun
@node Normalization Functions
@comment math.h
@comment ISO
@deftypefun double frexp (double @var{value}, int *@var{exponent})
+@comment math.h
+@comment ISO
@deftypefunx float frexpf (float @var{value}, int *@var{exponent})
+@comment math.h
+@comment ISO
@deftypefunx {long double} frexpl (long double @var{value}, int *@var{exponent})
These functions are used to split the number @var{value}
into a normalized fraction and an exponent.
@comment math.h
@comment ISO
@deftypefun double ldexp (double @var{value}, int @var{exponent})
+@comment math.h
+@comment ISO
@deftypefunx float ldexpf (float @var{value}, int @var{exponent})
+@comment math.h
+@comment ISO
@deftypefunx {long double} ldexpl (long double @var{value}, int @var{exponent})
These functions return the result of multiplying the floating-point
number @var{value} by 2 raised to the power @var{exponent}. (It can
@comment math.h
@comment BSD
@deftypefun double logb (double @var{x})
+@comment math.h
+@comment BSD
@deftypefunx float logbf (float @var{x})
+@comment math.h
+@comment BSD
@deftypefunx {long double} logbl (long double @var{x})
These functions return the integer part of the base-2 logarithm of
@var{x}, an integer value represented in type @code{double}. This is
@comment math.h
@comment BSD
@deftypefun double scalb (double @var{value}, int @var{exponent})
+@comment math.h
+@comment BSD
@deftypefunx float scalbf (float @var{value}, int @var{exponent})
+@comment math.h
+@comment BSD
@deftypefunx {long double} scalbl (long double @var{value}, int @var{exponent})
The @code{scalb} function is the BSD name for @code{ldexp}.
@end deftypefun
@comment math.h
@comment BSD
@deftypefun {long long int} scalbn (double @var{x}, int n)
+@comment math.h
+@comment BSD
@deftypefunx {long long int} scalbnf (float @var{x}, int n)
+@comment math.h
+@comment BSD
@deftypefunx {long long int} scalbnl (long double @var{x}, int n)
@code{scalbn} is identical to @code{scalb}, except that the exponent
@var{n} is an @code{int} instead of a floating-point number.
@comment math.h
@comment BSD
@deftypefun {long long int} scalbln (double @var{x}, long int n)
+@comment math.h
+@comment BSD
@deftypefunx {long long int} scalblnf (float @var{x}, long int n)
+@comment math.h
+@comment BSD
@deftypefunx {long long int} scalblnl (long double @var{x}, long int n)
@code{scalbln} is identical to @code{scalb}, except that the exponent
@var{n} is a @code{long int} instead of a floating-point number.
@comment math.h
@comment BSD
@deftypefun {long long int} significand (double @var{x})
+@comment math.h
+@comment BSD
@deftypefunx {long long int} significandf (float @var{x})
+@comment math.h
+@comment BSD
@deftypefunx {long long int} significandl (long double @var{x})
@code{significand} returns the mantissa of @var{x} scaled to the range
@math{[1, 2)}.
@comment math.h
@comment ISO
@deftypefun double ceil (double @var{x})
+@comment math.h
+@comment ISO
@deftypefunx float ceilf (float @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long double} ceill (long double @var{x})
These functions round @var{x} upwards to the nearest integer,
returning that value as a @code{double}. Thus, @code{ceil (1.5)}
@comment math.h
@comment ISO
@deftypefun double floor (double @var{x})
+@comment math.h
+@comment ISO
@deftypefunx float floorf (float @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long double} floorl (long double @var{x})
These functions round @var{x} downwards to the nearest
integer, returning that value as a @code{double}. Thus, @code{floor
@comment math.h
@comment ISO
@deftypefun double trunc (double @var{x})
+@comment math.h
+@comment ISO
@deftypefunx float truncf (float @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long double} truncl (long double @var{x})
@code{trunc} is another name for @code{floor}
@end deftypefun
@comment math.h
@comment ISO
@deftypefun double rint (double @var{x})
+@comment math.h
+@comment ISO
@deftypefunx float rintf (float @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long double} rintl (long double @var{x})
These functions round @var{x} to an integer value according to the
current rounding mode. @xref{Floating Point Parameters}, for
@comment math.h
@comment ISO
@deftypefun double nearbyint (double @var{x})
+@comment math.h
+@comment ISO
@deftypefunx float nearbyintf (float @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long double} nearbyintl (long double @var{x})
These functions return the same value as the @code{rint} functions, but
do not raise the inexact exception if @var{x} is not an integer.
@comment math.h
@comment ISO
@deftypefun double round (double @var{x})
+@comment math.h
+@comment ISO
@deftypefunx float roundf (float @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long double} roundl (long double @var{x})
These functions are similar to @code{rint}, but they round halfway
cases away from zero instead of to the nearest even integer.
@comment math.h
@comment ISO
@deftypefun {long int} lrint (double @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long int} lrintf (float @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long int} lrintl (long double @var{x})
These functions are just like @code{rint}, but they return a
@code{long int} instead of a floating-point number.
@comment math.h
@comment ISO
@deftypefun {long long int} llrint (double @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long long int} llrintf (float @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long long int} llrintl (long double @var{x})
These functions are just like @code{rint}, but they return a
@code{long long int} instead of a floating-point number.
@comment math.h
@comment ISO
@deftypefun {long int} lround (double @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long int} lroundf (float @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long int} lroundl (long double @var{x})
These functions are just like @code{round}, but they return a
@code{long int} instead of a floating-point number.
@comment math.h
@comment ISO
@deftypefun {long long int} llround (double @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long long int} llroundf (float @var{x})
+@comment math.h
+@comment ISO
@deftypefunx {long long int} llroundl (long double @var{x})
These functions are just like @code{round}, but they return a
@code{long long int} instead of a floating-point number.
@comment math.h
@comment ISO
@deftypefun double modf (double @var{value}, double *@var{integer-part})
+@comment math.h
+@comment ISO
@deftypefunx float modff (float @var{value}, float *@var{integer-part})
+@comment math.h
+@comment ISO
@deftypefunx {long double} modfl (long double @var{value}, long double *@var{integer-part})
These functions break the argument @var{value} into an integer part and a
fractional part (between @code{-1} and @code{1}, exclusive). Their sum
@comment math.h
@comment ISO
@deftypefun double fmod (double @var{numerator}, double @var{denominator})
+@comment math.h
+@comment ISO
@deftypefunx float fmodf (float @var{numerator}, float @var{denominator})
+@comment math.h
+@comment ISO
@deftypefunx {long double} fmodl (long double @var{numerator}, long double @var{denominator})
These functions compute the remainder from the division of
@var{numerator} by @var{denominator}. Specifically, the return value is
@comment math.h
@comment BSD
@deftypefun double drem (double @var{numerator}, double @var{denominator})
+@comment math.h
+@comment BSD
@deftypefunx float dremf (float @var{numerator}, float @var{denominator})
+@comment math.h
+@comment BSD
@deftypefunx {long double} dreml (long double @var{numerator}, long double @var{denominator})
These functions are like @code{fmod} except that they rounds the
internal quotient @var{n} to the nearest integer instead of towards zero
@comment math.h
@comment BSD
@deftypefun double remainder (double @var{numerator}, double @var{denominator})
+@comment math.h
+@comment BSD
@deftypefunx float remainderf (float @var{numerator}, float @var{denominator})
+@comment math.h
+@comment BSD
@deftypefunx {long double} remainderl (long double @var{numerator}, long double @var{denominator})
This function is another name for @code{drem}.
@end deftypefun
@comment math.h
@comment ISO
@deftypefun double copysign (double @var{x}, double @var{y})
+@comment math.h
+@comment ISO
@deftypefunx float copysignf (float @var{x}, float @var{y})
+@comment math.h
+@comment ISO
@deftypefunx {long double} copysignl (long double @var{x}, long double @var{y})
These functions return @var{x} but with the sign of @var{y}. They work
even if @var{x} or @var{y} are NaN or zero. Both of these can carry a
@comment math.h
@comment ISO
@deftypefun double nextafter (double @var{x}, double @var{y})
+@comment math.h
+@comment ISO
@deftypefunx float nextafterf (float @var{x}, float @var{y})
+@comment math.h
+@comment ISO
@deftypefunx {long double} nextafterl (long double @var{x}, long double @var{y})
The @code{nextafter} function returns the next representable neighbor of
@var{x} in the direction towards @var{y}. The size of the step between
@comment math.h
@comment ISO
-@deftypefun {long long int} nextafterx (double @var{x}, long double @var{y})
-@deftypefunx {long long int} nextafterxf (float @var{x}, long double @var{y})
-@deftypefunx {long long int} nextafterxl (long double @var{x}, long double @var{y})
+@deftypefun double nexttoward (double @var{x}, long double @var{y})
+@comment math.h
+@comment ISO
+@deftypefunx float nexttowardf (float @var{x}, long double @var{y})
+@comment math.h
+@comment ISO
+@deftypefunx {long double} nexttowardl (long double @var{x}, long double @var{y})
These functions are identical to the corresponding versions of
@code{nextafter} except that their second argument is a @code{long
double}.
@comment math.h
@comment ISO
@deftypefun double nan (const char *@var{tagp})
+@comment math.h
+@comment ISO
@deftypefunx float nanf (const char *@var{tagp})
+@comment math.h
+@comment ISO
@deftypefunx {long double} nanl (const char *@var{tagp})
The @code{nan} function returns a representation of NaN, provided that
NaN is supported by the target platform.
@comment math.h
@comment ISO
@deftypefun double fmin (double @var{x}, double @var{y})
+@comment math.h
+@comment ISO
@deftypefunx float fminf (float @var{x}, float @var{y})
+@comment math.h
+@comment ISO
@deftypefunx {long double} fminl (long double @var{x}, long double @var{y})
The @code{fmin} function returns the lesser of the two values @var{x}
and @var{y}. It is similar to the expression
@comment math.h
@comment ISO
@deftypefun double fmax (double @var{x}, double @var{y})
+@comment math.h
+@comment ISO
@deftypefunx float fmaxf (float @var{x}, float @var{y})
+@comment math.h
+@comment ISO
@deftypefunx {long double} fmaxl (long double @var{x}, long double @var{y})
The @code{fmax} function returns the greater of the two values @var{x}
and @var{y}.
@comment math.h
@comment ISO
@deftypefun double fdim (double @var{x}, double @var{y})
+@comment math.h
+@comment ISO
@deftypefunx float fdimf (float @var{x}, float @var{y})
+@comment math.h
+@comment ISO
@deftypefunx {long double} fdiml (long double @var{x}, long double @var{y})
The @code{fdim} function returns the positive difference between
@var{x} and @var{y}. The positive difference is @math{@var{x} -
@comment math.h
@comment ISO
@deftypefun double fma (double @var{x}, double @var{y}, double @var{z})
+@comment math.h
+@comment ISO
@deftypefunx float fmaf (float @var{x}, float @var{y}, float @var{z})
+@comment math.h
+@comment ISO
@deftypefunx {long double} fmal (long double @var{x}, long double @var{y}, long double @var{z})
@cindex butterfly
The @code{fma} function performs floating-point multiply-add. This is
@comment complex.h
@comment ISO
@deftypefun double creal (complex double @var{z})
+@comment complex.h
+@comment ISO
@deftypefunx float crealf (complex float @var{z})
+@comment complex.h
+@comment ISO
@deftypefunx {long double} creall (complex long double @var{z})
These functions return the real part of the complex number @var{z}.
@end deftypefun
@comment complex.h
@comment ISO
@deftypefun double cimag (complex double @var{z})
+@comment complex.h
+@comment ISO
@deftypefunx float cimagf (complex float @var{z})
+@comment complex.h
+@comment ISO
@deftypefunx {long double} cimagl (complex long double @var{z})
These functions return the imaginary part of the complex number @var{z}.
@end deftypefun
@comment complex.h
@comment ISO
@deftypefun {complex double} conj (complex double @var{z})
+@comment complex.h
+@comment ISO
@deftypefunx {complex float} conjf (complex float @var{z})
+@comment complex.h
+@comment ISO
@deftypefunx {complex long double} conjl (complex long double @var{z})
These functions return the conjugate value of the complex number
@var{z}. The conjugate of a complex number has the same real part and a
@comment complex.h
@comment ISO
@deftypefun double carg (complex double @var{z})
+@comment complex.h
+@comment ISO
@deftypefunx float cargf (complex float @var{z})
+@comment complex.h
+@comment ISO
@deftypefunx {long double} cargl (complex long double @var{z})
These functions return the argument of the complex number @var{z}.
The argument of a complex number is the angle in the complex plane
@comment complex.h
@comment ISO
@deftypefun {complex double} cproj (complex double @var{z})
+@comment complex.h
+@comment ISO
@deftypefunx {complex float} cprojf (complex float @var{z})
+@comment complex.h
+@comment ISO
@deftypefunx {complex long double} cprojl (complex long double @var{z})
These functions return the projection of the complex value @var{z} onto
the Riemann sphere. Values with a infinite imaginary part are projected
The @code{lldiv} function was added in @w{ISO C 9x}.
@end deftypefun
+@comment inttypes.h
+@comment ISO
+@deftp {Data Type} imaxdiv_t
+This is a structure type used to hold the result returned by the @code{imaxdiv}
+function. It has the following members:
+
+@table @code
+@item intmax_t quot
+The quotient from the division.
+
+@item intmax_t rem
+The remainder from the division.
+@end table
+
+(This is identical to @code{div_t} except that the components are of
+type @code{intmax_t} rather than @code{int}.)
+@end deftp
+
+@comment inttypes.h
+@comment ISO
+@deftypefun imaxdiv_t imaxdiv (intmax_t @var{numerator}, intmax_t @var{denominator})
+The @code{imaxdiv} function is like the @code{div} function, but the
+arguments are of type @code{intmax_t} and the result is returned as
+a structure of type @code{imaxdiv_t}.
+
+The @code{imaxdiv} function was added in @w{ISO C 9x}.
+@end deftypefun
+
@node Parsing of Numbers
@section Parsing of Numbers
@item
A nonempty sequence of digits optionally containing a decimal-point
character---normally @samp{.}, but it depends on the locale
-(@pxref{Numeric Formatting}).
+(@pxref{General Numeric}).
@item
An optional exponent part, consisting of a character @samp{e} or
@comment stdlib.h
@comment GNU
@deftypefun float strtof (const char *@var{string}, char **@var{tailptr})
+@comment stdlib.h
+@comment GNU
@deftypefunx {long double} strtold (const char *@var{string}, char **@var{tailptr})
These functions are analogous to @code{strtod}, but return @code{float}
and @code{long double} values respectively. They report errors in the