fmax(3)
π fmax(3) β the "who's bigger bestie" page π
okay so first things first, this is a page from the Library Functions Manual, and it's all about the trio of legends known as fmax, fmaxf, and fmaxl. They look at two floating-point numbers and are like "which one of you is serving more magnitude" and then hand you the winner. no cap, that's the whole job. π¦
πΈ NAME πΈ
fmax, fmaxf, fmaxl β determine maximum of two floating-point numbers
π LIBRARY π
Math library (libm, -lm) π
bestie if your link line doesn't have -lm she will simply not show up, and you'll be sitting there confused like "where is my max" π
β¨ SYNOPSIS β¨
#include <math.h>
double fmax(double x, double y);
float fmaxf(float x, float y);
long double fmaxl(long double x, long double y);
π Feature Test Macro Requirements for glibc π
(peep feature_test_macros(7) for the whole lore, but here's the tea π)
fmax(),fmaxf(),fmaxl():_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
π DESCRIPTION π
These functions return the larger value of x and y.
that's it. that's the function. it's giving "pick the bigger one" and honestly? iconic. no drama, no side quests, just pure comparison energy. π
π RETURN VALUE π
These functions return the maximum of x and y.
and now for the plot twist that makes her so beloved:
- If one argument is a
NaN, the other argument is returned. π (yes queen, she does NOT let aNaNruin the whole vibe, she just hands you the other one) - If both arguments are
NaN, aNaNis returned. π (yeah if literally everyone is aNaNthen... that's what you get back, fr fr)
π ERRORS π
No errors occur.
not one. zero. none. she doesn't do errors, she just does maximum. πβ¨
π ATTRIBUTES π
For an explanation of the terms used in this section, see attributes(7).
(no tables in the group chat, so here's the same info as bullets, bestie π§)
- Interface:
fmax(),fmaxf(),fmaxl() - Attribute: Thread safety
- Value:
MT-Safe
MT-Safe means you can call her from multiple threads and she will not have a breakdown. multi-threaded main character energy, we love to see it. π₯
π¦ STANDARDS π¦
C11, POSIX.1-2008.
certified, standardized, and standing on business. β
π HISTORY π
glibc 2.1. C99, POSIX.1-2001.
she's been around since glibc 2.1 and knows things, okay? elder but still that girl. π
π SEE ALSO π
(go say hi to fmin(3), she's literally the opposite vibe and also a queen π«Ά)
and that's the whole page bestie!! πβ¨ this was brought to you by Linux man-pages 6.20, dated 2026-02-08 β so you know it's fresh, you know it's slay, you know it's giving official documentation. now go fmax something and thrive ππ
π
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-1.0-or-later
- Copyright 2002, Walter Harms <walter.harms@informatik.uni-oldenburg.de>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms