isgreater(3)

πŸ’– isgreater(3) β€” floating-point relational tests, but make it NaN-safe πŸ’–

okay bestie, so this is a page from the Library Functions Manual, and it's about a lil family of macros that do comparisons without having a meltdown when NaN shows up πŸ’…


✨ NAME ✨

isgreater, isgreaterequal, isless, islessequal, islessgreater, isunordered β€” floating-point relational tests without exception for NaN πŸ¦‹

πŸ“š LIBRARY πŸ“š

Math library (libm, -lm) β€” yeah you gotta link it, that's just the vibe.

🌸 SYNOPSIS 🌸

#include <math.h>

int isgreater(x, y);
int isgreaterequal(x, y);
int isless(x, y);
int islessequal(x, y);
int islessgreater(x, y);
int isunordered(x, y);

πŸŽ€ Feature Test Macro Requirements for glibc (see feature_test_macros(7)): πŸŽ€

All functions described here:

_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L

πŸ‘‘ DESCRIPTION πŸ‘‘

ok so here's the tea β˜• β€” the normal relational operations (like <, that's "less than") literally fail if one of the operands is NaN. and not in a cute way, it causes an exception. so to dodge all that drama, C99 defines the macros listed below. era-defining honestly ✨

these macros are guaranteed to evaluate their arguments only once. and the arguments must be of real floating-point type. quick PSA: do NOT pass integer values as arguments to these macros, because the arguments will not be promoted to real-floating types. not me warning you twice, but like, i'm warning you twice πŸ™ˆ

  • isgreater() β€” figures out (x) > (y) without an exception if x or y is NaN.
  • isgreaterequal() β€” figures out (x) >= (y) without an exception if x or y is NaN.
  • isless() β€” figures out (x) < (y) without an exception if x or y is NaN.
  • islessequal() β€” figures out (x) <= (y) without an exception if x or y is NaN.
  • islessgreater() β€” figures out (x) < (y) || (x) > (y) without an exception if x or y is NaN. ⚠️ and this macro is not equivalent to x != y, because that expression is true if x or y is NaN. so like, don't try that shortcut bestie, it's giving wrong answers πŸ’€
  • isunordered() β€” figures out whether its arguments are unordered, which is just a fancy way of saying: is at least one of the arguments a NaN? 🧚

πŸ’« RETURN VALUE πŸ’«

every macro except isunordered() returns the result of the relational comparison. and those macros return 0 if either argument is a NaN. (yeah, NaN just kills the whole comparison, that's the point.)

isunordered() returns 1 if x or y is NaN, and 0 otherwise. simple. iconic. slay πŸ’…


πŸ’€ ERRORS πŸ’€

No errors occur. literally none. that's the entire flex of this page, no cap. ✨


🌈 ATTRIBUTES 🌈

for an explanation of the terms used in this section, see attributes(7).

  • Interface: isgreater(), isgreaterequal(), isless(), islessequal(), islessgreater(), isunordered()
    • Attribute: Thread safety
    • Value: MT-Safe πŸ‘‘

so yeah, all of them are MT-Safe. go wild with your threads, it's fine 🫢


πŸ¦‹ VERSIONS πŸ¦‹

not all hardware supports these functions, and where hardware support isn't provided, they'll be emulated by macros instead. and that comes with a performance penalty 😭.

don't use these functions if NaN is of no concern for you. fr fr, if you don't care about NaN, you're just paying the vibe tax for nothing.

⭐ STANDARDS ⭐

C11, POSIX.1-2008.


🌸 HISTORY 🌸

POSIX.1-2001, C99.


πŸŽ€ SEE ALSO πŸŽ€


and that's the whole page, bestie! this was isgreater(3) from Linux man-pages 6.20, dated 2026-02-08 β€” go forth and compare floats without fear of exceptions πŸ’–βœ¨πŸ¦‹πŸ’…

πŸ“¦ 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