FREXP(3POSIX)

πŸ’– FREXP(3POSIX) β€” the POSIX Programmer's Manual, but make it cute πŸ’–

okay bestie, welcome to FREXP(3POSIX), part of the POSIX Programmer's Manual. grab a boba, we're doing floating-point math 🌸


🚨 PROLOG (read this first, fr fr)

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β€” so like, consult the corresponding Linux manual page for the deets on Linux behavior β€” or honestly the interface might not even be implemented on Linux at all. πŸ’€


✨ NAME ✨

frexp, frexpf, frexpl β€” extract mantissa and exponent from a double precision number 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <math.h>

double frexp(double num, int *exp);
float frexpf(float num, int *exp);
long double frexpl(long double num, int *exp);

three whole flavors of the same vibe, pick your precision babes πŸ’…


🌈 DESCRIPTION 🌈

The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional β€” no drama intended, it's giving "we defer". This volume of POSIX.1‐2017 defers to the ISO C standard. periodt.

These functions shall break a floating-point number num into a normalized fraction and an integral power of 2. The integer exponent shall be stored in the int object pointed to by exp. so like, you hand it a number and a lil pointer, and it splits the number into "the cute part" and "the power-of-two part" ✨


πŸ‘‘ RETURN VALUE πŸ‘‘

For finite arguments, these functions shall return the value x, such that x has a magnitude in the interval [Β½,1) or 0, and num equals x times 2 raised to the power *exp.

  • If num is NaN, a NaN shall be returned, and the value of *exp is unspecified. πŸ™ˆ
  • If num is Β±0, Β±0 shall be returned, and the value of *exp shall be 0.
  • If num is Β±Inf, num shall be returned, and the value of *exp is unspecified. 😭
bestie, "unspecified" means the standard is NOT promising you anything about *exp in those cases. do not go reading it and assuming. that's not the move. 🚫

πŸ’€ ERRORS πŸ’€

No errors are defined. iconic behavior honestly, zero problems, zero notes.

The following sections are informative.


πŸ“ EXAMPLES πŸ“

None. (yes, really. nothing. empty. a void. the silence is loud. πŸ¦‹)


🧚 APPLICATION USAGE 🧚

None.


πŸ’œ RATIONALE πŸ’œ

None.


🌸 FUTURE DIRECTIONS 🌸

None.


⭐ SEE ALSO ⭐

  • isnan()
  • ldexp()
  • modf()

The Base Definitions volume of POSIX.1‐2017, <math.h>


Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page bestie!! brought to you by IEEE/The Open Group, 2017 β€” the year this manual was born, which is lowkey ancient but we respect our elders πŸ’– go forth and split your floats, you're doing amazing sweetie πŸŽ€βœ¨