| 1 |
'\" t |
| 2 |
.\" Copyright 1993, David Metcalfe <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH modf 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
modf, modff, modfl \- extract signed integral and fractional values from |
| 10 |
floating-point number |
| 11 |
.SH LIBRARY |
| 12 |
Math library |
| 13 |
.RI ( libm ,\~ \-lm ) |
| 14 |
.SH SYNOPSIS |
| 15 |
.nf |
| 16 |
.B #include <math.h> |
| 17 |
.P |
| 18 |
.BI "double modf(double " x ", double *" iptr ); |
| 19 |
.BI "float modff(float " x ", float *" iptr ); |
| 20 |
.BI "long double modfl(long double " x ", long double *" iptr ); |
| 21 |
.fi |
| 22 |
.P |
| 23 |
.RS -4 |
| 24 |
Feature Test Macro Requirements for glibc (see |
| 25 |
.BR feature_test_macros (7)): |
| 26 |
.RE |
| 27 |
.P |
| 28 |
.BR modff (), |
| 29 |
.BR modfl (): |
| 30 |
.nf |
| 31 |
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
| 32 |
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE |
| 33 |
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE |
| 34 |
.fi |
| 35 |
.SH DESCRIPTION |
| 36 |
These functions break the argument |
| 37 |
.I x |
| 38 |
into an integral |
| 39 |
part and a fractional part, each of which has the same sign as |
| 40 |
.IR x . |
| 41 |
The integral part is stored in the location pointed to by |
| 42 |
.IR iptr . |
| 43 |
.SH RETURN VALUE |
| 44 |
These functions return the fractional part of |
| 45 |
.IR x . |
| 46 |
.P |
| 47 |
If |
| 48 |
.I x |
| 49 |
is a NaN, a NaN is returned, and |
| 50 |
.I *iptr |
| 51 |
is set to a NaN. |
| 52 |
.P |
| 53 |
If |
| 54 |
.I x |
| 55 |
is positive infinity (negative infinity), +0 (\-0) is returned, and |
| 56 |
.I *iptr |
| 57 |
is set to positive infinity (negative infinity). |
| 58 |
.SH ERRORS |
| 59 |
No errors occur. |
| 60 |
.SH ATTRIBUTES |
| 61 |
For an explanation of the terms used in this section, see |
| 62 |
.BR attributes (7). |
| 63 |
.TS |
| 64 |
allbox; |
| 65 |
lbx lb lb |
| 66 |
l l l. |
| 67 |
Interface Attribute Value |
| 68 |
T{ |
| 69 |
.na |
| 70 |
.nh |
| 71 |
.BR modf (), |
| 72 |
.BR modff (), |
| 73 |
.BR modfl () |
| 74 |
T} Thread safety MT-Safe |
| 75 |
.TE |
| 76 |
.SH STANDARDS |
| 77 |
C11, POSIX.1-2008. |
| 78 |
.SH HISTORY |
| 79 |
C99, POSIX.1-2001. |
| 80 |
.P |
| 81 |
The variant returning |
| 82 |
.I double |
| 83 |
also conforms to |
| 84 |
SVr4, 4.3BSD, C89. |
| 85 |
.SH SEE ALSO |
| 86 |
.BR frexp (3), |
| 87 |
.BR ldexp (3) |