finite(3)
π finite(3) β the BSD float-classification girlies π
okay bestie, pull up a chair, we're doing finite(3) from the Library Functions Manual today and honestly? it's giving "legacy but iconic". π
β¨ NAME β¨
finite, finitef, finitel, isinf, isinff, isinfl, isnan, isnanf, isnanl β the BSD floating-point classification functions. that's the whole squad. π«Ά
π LIBRARY π
Math library, aka libm, aka you link it with -lm. don't forget her. she WILL ghost you if you forget her. π
-lm
πΈ SYNOPSIS πΈ
first things first, you gotta include the header:
#include <math.h>
then here's the whole friend group, all typed out:
int finite(double x);
int finitef(float x);
int finitel(long double x);
int isinf(double x);
int isinff(float x);
int isinfl(long double x);
int isnan(double x);
int isnanf(float x);
int isnanl(long double x);
π§ Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
okay so this is the part where glibc makes you prove you're allowed to use these. rude? yes. necessary? also yes. here's exactly what you need, no cap:
finite(), finitef(), finitel():
/* glibc >= 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
isinf():
_XOPEN_SOURCE >= 600 || _ISOC99_SOURCE
|| /* glibc >= 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
isinff(), isinfl():
/* glibc >= 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
isnan():
_XOPEN_SOURCE || _ISOC99_SOURCE
|| /* glibc >= 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
isnanf(), isnanl():
_XOPEN_SOURCE >= 600
|| /* glibc >= 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
π₯ DESCRIPTION π₯
so what do these actually do? lemme break it down, bestie, one function family at a time.
finite(),finitef(),finitel()β these return a nonzero value ifxis neither infinite nor a "not-a-number" (NaN) value, and0otherwise. so basically: "is this number a normal, well-adjusted member of society?" yes β nonzero. no β0. πisnan(),isnanf(),isnanl()β these return a nonzero value ifxis a NaN value, and0otherwise. the detector for when your math went completely off the rails. πisinf(),isinff(),isinfl()β these return1ifxis positive infinity,-1ifxis negative infinity, and0otherwise. three possible answers, not just two β she's nuanced. π
π¦ ATTRIBUTES π¦
for the whole "what do these terms even mean" situation, go peek at attributes(7). the original prints this as a table, but tables don't exist in our group chat so here it is as a vibe:
- Interface:
finite(),finitef(),finitel(),isinf(),isinff(),isinfl(),isnan(),isnanf(),isnanl() - Attribute: Thread safety
- Value:
MT-Safe
so yeah β all nine of them are MT-Safe, every single one, no exceptions. π«Ά
β οΈ NOTES β οΈ
okay so this is the part where I have to be real with you:
these functions are obsolete. like, deprecated-era. C99 defines the macrosisfinite(),isinf(), andisnan()(for all types) and those are what replaced them. π
and there's more β the C99 isinf() has weaker guarantees on the return value than the one you're reading about right now. so heads up on that.
go read fpclassify(3) for the full tea. πΈ
β SEE ALSO β
so that's finite(3)! iconic, a little vintage, still lives in libm rent-free. go forth and classify your floats, bestie π
β¨
this page was rocking Linux man-pages 6.20, dated 2026-02-08 β ty for coming to my TED talk, mwah ππ¦π
π¦ 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: Linux-man-pages-copyleft
- Copyright 2004, Andries E. Brouwer <aeb@cwi.nl>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms