fdim(), fdimf(), fdiml() — Calculate the positive difference

Standards

Standards / Extensions C or C++ Dependencies

C99
Single UNIX Specification, Version 3
C++ TR1 C99

both z/OS® V1R5

Format

#define _ISOC99_SOURCE
#include <math.h>

double fdim(double x, double y);
float fdimf(float x, float y);
long double fdiml(long double x, long  double y);
C++ TR1 C99:
#define _TR1_C99
#include <math.h>

float fdim(float x, float y); 
long double fdim(long double x, long double y);

General description

The fdim functions compute the positive difference between x and y.
Note: The following table shows the viable formats for these functions. See IEEE binary floating-point for more information about IEEE Binary Floating-Point.
Function Hex IEEE
fdim X X
fdimf X X
fdiml X X
Restriction: The fdimf() function does not support the _FP_MODE_VARIABLE feature test macro.

Returned value

The fdim functions return the positive difference between x and y.

Related information