fmaximumf(3)

fmaximumf3

Floating-point maximum and minimum functions

Part of fmaximum(3).

Usage

#include <math.h>

double

fmaximum(double x, double y);

float

fmaximumf(float x, float y);

long double

fmaximuml(long double x, long double y);

double

fminimum(double x, double y);

float

fminimumf(float x, float y);

long double

fminimuml(long double x, long double y);

Library

Math Library (libm, -lm)

Overview

The fmaximum(), fmaximumf(), and fmaximuml() functions return the larger of x and y, and likewise, the fminimum(), fminimumf(), and fminimuml() functions return the smaller of x and y. They treat +0.0 as being larger than -0.0.

Unlike the fmax(3) family of functions, which ignore an , if either argument to fmaximum() or fminimum() is an , then the result is an . These routines do not raise any floating-point exceptions.

Standards

The fmaximum(), fmaximumf(), fmaximuml(), fminimum(), fminimumf(), and fminimuml() functions conform to ISO/IEC 9899:2024 (“ISO C23”).

History

These routines first appeared in FreeBSD 16.0.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.