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 a NaN ruin the whole vibe, she just hands you the other one)
  • If both arguments are NaN, a NaN is returned. πŸ’€ (yeah if literally everyone is a NaN then... 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms