# mathintroduction to mathematical library functions

## SYNOPSIS

#include <math.h>

## DESCRIPTION

These functions constitute the C math library, libm. The link editor searches this library under the -lm option. Declarations for these functions may be obtained from the include file <math.h>.

Please consult <fenv.h>, <complex.h>, and <tgmath.h> for other math components.

## LIST OF FUNCTIONS

### Algebraic Functions

 Name Description cbrt() cube root fma() fused multiply-add hypot() Euclidean distance sqrt() square root

### Classification Macros

 Name Description fpclassify() classify a floating-point value isfinite() determine whether a value is finite isinf() determine whether a value is infinite isnan() determine whether a value is NaN isnormal() determine whether a value is normalized

### Exponent Manipulation Functions

 Name Description frexp() extract exponent and mantissa ilogb() extract exponent ldexp() multiply by power of 2 logb() extract exponent scalbln() adjust exponent scalbn() adjust exponent

### Extremum- and Sign-Related Functions

 Name Description copysign() copy sign bit fabs() absolute value fdim() positive difference fmax() maximum function fmin() minimum function signbit() extract sign bit

### Not a Number Functions

 Name Description nan() generate a quiet NaN

### Residue and Rounding Functions

 Name Description ceil() integer no less than floor() integer no greater than fmod() positive remainder llrint() round to integer in fixed-point format llround() round to nearest integer in fixed-point format lrint() round to integer in fixed-point format lround() round to nearest integer in fixed-point format modf() extract integer and fractional parts nearbyint() round to integer (silent) nextafter() next representable value nexttoward() next representable value remainder() remainder remquo() remainder with partial quotient rint() round to integer round() round to nearest integer trunc() integer no greater in magnitude than

The ceil(), floor(), llround(), lround(), round(), and trunc() functions round in predetermined directions, whereas llrint(), lrint(), and rint() round according to the current (dynamic) rounding mode. For more information on controlling the dynamic rounding mode, see fenv() and fesetround().

### Silent Order Predicates

 Name Description isgreater() greater than relation isgreaterequal() greater than or equal to relation isless() less than relation islessequal() less than or equal to relation islessgreater() less than or greater than relation isunordered() unordered relation

### Transcendental Functions

 Name Description acos() inverse trigonometric function acosh() inverse hyperbolic function asin() inverse trigonometric function asinh() inverse hyperbolic function atan() inverse trigonometric function atanh() inverse hyperbolic function atan2() inverse trigonometric function cos() trigonometric function cosh() hyperbolic function erf() error function erfc() complementary error function exp() base e exponential exp2() base 2 exponential expm1() exp(x)-1 j0() bessel function j1() bessel function jn() bessel function lgamma() log gamma function log() natural logarithm log2() logarithm to base 2 log10() logarithm to base 10 log1p() log(1+x) sin() trigonometric function sinh() hyperbolic function tan() trigonometric function tanh() hyperbolic function y0() bessel function y1() bessel function yn() bessel function

The routines in this section might not produce a result that is correctly rounded, so reproducible results cannot be guaranteed across platforms. For most of these functions, however, incorrect rounding occurs rarely, and then only in very-close-to-halfway cases.

## NOTES

The math library can handle floating point exceptions in different ways depending upon the level of standards conformance that the user desires. The math library currently supports the following personality modes:

```__XOPEN__
__POSIX__
__SVID__
__IEEE__
```

For details on these personality modes, see the _NutLibMSetLibraryType() reference page.

By default, floating-point exeptions are masked in processor hardware. It enable/disable/query exceptions, use fenv() functions feenableexcept (), fedisableexcept(), and fegetexcept(). Hardware exceptions will then be converted to signals and may be trapped by SIGFPE handers.

## CONFORMANCE

ANSI/ISO 9899:1999 'ISO C99'.

## AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition