modf(3)

πŸ’– modf β€” bestie edition πŸ’–

okay so this is the manual page for modf, modff, and modfl β€” the <pink>libm</pink> girlies that literally split your floating-point number into two pieces. It's <cyan>modf(3)</cyan> from the Linux man-pages, and yes we're doing this. πŸŽ€


✨ NAME ✨

modf, modff, modfl β€” pull the signed integral part and the fractional part out of a floating-point number πŸ¦‹

πŸ“š LIBRARY πŸ“š

Math library, aka <mint>libm</mint> β€” link it with <yellow>-lm</yellow>.

🌸 SYNOPSIS 🌸

#include <math.h>

double modf(double x, double *iptr);
float modff(float x, float *iptr);
long double modfl(long double x, long double *iptr);

🧚 Feature Test Macro Requirements for glibc (see feature_test_macros(7))

For modff(), modfl():

_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
    || /* Since glibc 2.19: */ _DEFAULT_SOURCE
    || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE

like, yes, the whole chain, don't skip any of it bestie πŸ’…

πŸ’« DESCRIPTION πŸ’«

These functions take the argument x and snap it in half β€” one integral part, one fractional part β€” and <hotpink>both of them keep the same sign as x</hotpink>. The integral part gets yeeted into the location that iptr points to. πŸ“

πŸ”₯ RETURN VALUE πŸ”₯

They hand you back the <purple>fractional part</purple> of x. periodt.

  • If x is a NaN, a NaN comes back, and *iptr is set to a NaN. 😭 (yes, both. NaN all the way down.)
  • If x is positive infinity (or negative infinity), then +0 (or -0) is returned, and *iptr is set to positive infinity (or negative infinity). ♾️

πŸ’€ ERRORS πŸ’€

No errors occur. not a single one. she's chill like that. πŸ’…

πŸ‘‘ ATTRIBUTES πŸ‘‘

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

  • Interface: modf(), modff(), modfl()
  • Attribute: Thread safety
  • Value: MT-Safe ✨ (yes she's safe to run in threads, we love a secure queen)

🌈 STANDARDS 🌈

C11, POSIX.1-2008.

πŸ•°οΈ HISTORY πŸ•°οΈ

  • C99, POSIX.1-2001.
  • The variant that returns double also conforms to SVr4, 4.3BSD, C89. look at her, legacy icon behavior πŸ‘‘

πŸ”­ SEE ALSO πŸ”­


and that's the whole page, bestie 🫢 this was Linux man-pages <pink>6.20</pink>, dated <lavender>2026-02-08</lavender>, and modf(3) ate and left no crumbs. πŸ’–βœ¨πŸŽ€

πŸ“¦ 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms