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
xis aNaN, aNaNcomes back, and*iptris set to aNaN. π (yes, both. NaN all the way down.) - If
xis positive infinity (or negative infinity), then+0(or-0) is returned, and*iptris 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
doublealso conforms toSVr4,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
- Copyright 1993, David Metcalfe <david@prism.demon.co.uk>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms