# Miscellaneous Functions

Many routines in the Intel® Math Library are more optimized for Intel® microprocessors than for non-Intel microprocessors.

The mathimf.h header file includes prototypes for Intel® Math Library functions.

The Intel® Math Library supports the following miscellaneous functions:

## copysign

Description: The copysign function returns the value with the magnitude of `x` and the sign of `y`.

Calling interface:
`double copysign(double x, double y);`
`long double copysignl(long double x, long double y);`
`float copysignf(float x, float y);`

## fabs

Description: The fabs function returns the absolute value of `x`.

Calling interface:
`double fabs(double x);`
`long double fabsl(long double x);`
`float fabsf(float x);`

## fdim

Description: The fdim function returns the positive difference value, `x-y` (for `x > y`) or +0 (for `x <= to y`).

errno: ERANGE, for overflow conditions

Calling interface:
`double fdim(double x, double y);`
`long double fdiml(long double x, long double y);`
`float fdimf(float x, float y);`

## finite

Description: The `finite` function returns 1 if `x` is not a `NaN` or +/- infinity. Otherwise 0 is returned.

Calling interface:
`int finite(double x);`
`int finitel(long double x);`
`int finitef(float x);`

## fma

Description: The fma functions return `(x*y)+z`.

Calling interface:
`double fma(double x, double y, double z);`
`long double fmal(long double x, long double y, long double z);`
`float fmaf(float x, float y, float z);`

## fmax

Description: The fmax function returns the maximum numeric value of its arguments.

Calling interface:
`double fmax(double x, double y);`
`long double fmaxl(long double x, long double y);`
`float fmaxf(float x, float y);`

## fmin

Description: The fmin function returns the minimum numeric value of its arguments.

Calling interface:
`double fmin(double x, double y);`
`long double fminl(long double x, long double y);`
`float fminf(float x, float y);`

## fpclassify

Description: The fpclassify function returns the value of the number classification macro appropriate to the value of its argument.

Return Value
0 (NaN)
1 (Infinity)
2 (Zero)
3 (Subnormal)
4 (Finite)

Calling interface:
`int fpclassify(double x);`
`int fpclassifyl(long double x);`
`int fpclassifyf(float x);`

## isfinite

Description: The isfinite function returns 1 if `x` is not a NaN or +/- infinity. Otherwise 0 is returned.

Calling interface:
`int isfinite(double x);`
`int isfinitel(long double x);`
`int isfinitef(float x);`

## isgreater

Description: The isgreater function returns 1 if `x` is greater than `y`. This function does not raise the invalid floating-point exception.

Calling interface:
`int isgreater(double x, double y);`
`int isgreaterl(long double x, long double y);`
`int isgreaterf(float x, float y);`

## isgreaterequal

Description: The isgreaterequal function returns 1 if `x` is greater than or equal to `y`. This function does not raise the invalid floating-point exception.

Calling interface:
`int isgreaterequal(double x, double y);`
`int isgreaterequall(long double x, long double y);`
`int isgreaterequalf(float x, float y);`

## isinf

Description: The isinf function returns a non-zero value if and only if its argument has an infinite value.

Calling interface:
`int isinf(double x);`
`int isinfl(long double x);`
`int isinff(float x);`

## isless

Description: The isless function returns 1 if `x` is less than `y`. This function does not raise the invalid floating-point exception.

Calling interface:
`int isless(double x, double y);`
`int islessl(long double x, long double y);`
`int islessf(float x, float y);`

## islessequal

Description: The islessequal function returns 1 if `x` is less than or equal to `y`. This function does not raise the invalid floating-point exception.

Calling interface:
`int islessequal(double x, double y);`
`int islessequall(long double x, long double y);`
`int islessequalf(float x, float y);`

## islessgreater

Description: The islessgreater function returns 1 if `x` is less than or greater than `y`. This function does not raise the invalid floating-point exception.

Calling interface:
`int islessgreater(double x, double y);`
`int islessgreaterl(long double x, long double y);`
`int islessgreaterf(float x, float y);`

## isnan

Description: The isnan function returns a non-zero value, if and only if `x` has a NaN value.

Calling interface:
`int isnan(double x);`
`int isnanl(long double x);`
`int isnanf(float x);`

## isnormal

Description: The isnormal function returns a non-zero value, if and only if `x` is normal.

Calling interface:
`int isnormal(double x);`
`int isnormall(long double x);`
`int isnormalf(float x);`

## isunordered

Description: The isunordered function returns 1 if either `x` or `y` is a NaN. This function does not raise the invalid floating-point exception.

Calling interface:
`int isunordered(double x, double y);`
`int isunorderedl(long double x, long double y);`
`int isunorderedf(float x, float y);`

## maxmag

Description: The maxmag function returns the value of larger magnitude from among its two arguments, `x` and `y`. If `|x| > |y|` it returns `x`; if `|y| > |x|` it returns `y`; otherwise it behaves like `fmax(x,y)`.

Calling interface:
`double maxmag(double x, double y);`
`float maxmagf(float x, float y);`

## minmag

Description: The minmag function returns the value of smaller magnitude from among its two arguments, `x` and `y`. If `|x| < |y|` it returns `x`; if `|y| < |x|` it returns `y`; otherwise it behaves like `fmin(x,y)`.

Calling interface:
`double minmag(double x, double y);`
`float minmagf(float x, float y);`

## nan

Description: The nan function returns a quiet NaN, with content indicated through `tagp`.

Calling interface:

    double nan(const char *tagp);
    long double nanl(const char *tagp);
    float nanf(const char *tagp);

## nextafter

Description: The nextafter function returns the next representable value in the specified format after `x` in the direction of `y`.

errno: ERANGE, for overflow conditions

Calling interface:
`double nextafter(double x, double y);`
`long double nextafterl(long double x, long double y);`
`float nextafterf(float x, float y);`

## nexttoward

Description: The nexttoward function returns the next representable value in the specified format after `x` in the direction of `y`. If `x` equals `y`, then the function returns `y` converted to the type of the function. Use the Qlong-double option (for C++ only) on Windows* operating systems for accurate results.

errno: ERANGE, for overflow and underflow conditions

Calling interface:
`double nexttoward(double x, long double y);`
`long double nexttowardl(long double x, long double y);`
`float nexttowardf(float x, long double y);`

## signbit

Description: The signbit function returns a non-zero value, if and only if the sign of `x` is negative.

Calling interface:
`int signbit(double x);`
`int signbitl(long double x);`
`int signbitf(float x);`

## significand

Description: The significand function returns the significand of `x` in the interval [1,2). For `x` equal to zero, NaN, or +/- infinity, the original `x` is returned.

Calling interface:
`double significand(double x);`
`long double significandl(long double x);`
`float significandf(float x);`

Parent topic: Math Functions