241 lines
5.2 KiB
HTML
241 lines
5.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of FPCLASSIFY</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>FPCLASSIFY</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
fpclassify, isfinite, isnormal, isnan, isinf - floating-point
|
|
classification macros
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/math.h">math.h</A>></B>
|
|
|
|
<B>int fpclassify(</B><I>x</I><B>);</B>
|
|
|
|
<B>int isfinite(</B><I>x</I><B>);</B>
|
|
|
|
<B>int isnormal(</B><I>x</I><B>);</B>
|
|
|
|
<B>int isnan(</B><I>x</I><B>);</B>
|
|
|
|
<B>int isinf(</B><I>x</I><B>);</B>
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
Link with <I>-lm</I>.
|
|
<P>
|
|
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
<B>fpclassify</B>(),
|
|
|
|
<B>isfinite</B>(),
|
|
|
|
<B>isnormal</B>():
|
|
|
|
<DL COMPACT><DT id="1"><DD>
|
|
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|
|
</DL>
|
|
|
|
<B>isnan</B>():
|
|
|
|
<DL COMPACT><DT id="2"><DD>
|
|
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|
|
<BR> || _XOPEN_SOURCE
|
|
<BR> || /* Since glibc 2.19: */ _DEFAULT_SOURCE
|
|
<BR> || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
|
|
</DL>
|
|
|
|
<B>isinf</B>():
|
|
|
|
<DL COMPACT><DT id="3"><DD>
|
|
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|
|
<BR> || /* Since glibc 2.19: */ _DEFAULT_SOURCE
|
|
<BR> || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
|
|
</DL>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
Floating point numbers can have special values, such as
|
|
infinite or NaN.
|
|
With the macro
|
|
<B>fpclassify(</B><I>x</I><B>)</B>
|
|
|
|
you can find out what type
|
|
<I>x</I>
|
|
|
|
is.
|
|
The macro takes any floating-point expression as argument.
|
|
The result is one of the following values:
|
|
<DL COMPACT>
|
|
<DT id="4"><B>FP_NAN</B>
|
|
|
|
<DD>
|
|
<I>x</I>
|
|
|
|
is "Not a Number".
|
|
<DT id="5"><B>FP_INFINITE</B>
|
|
|
|
<DD>
|
|
<I>x</I>
|
|
|
|
is either positive infinity or negative infinity.
|
|
<DT id="6"><B>FP_ZERO</B>
|
|
|
|
<DD>
|
|
<I>x</I>
|
|
|
|
is zero.
|
|
<DT id="7"><B>FP_SUBNORMAL</B>
|
|
|
|
<DD>
|
|
<I>x</I>
|
|
|
|
is too small to be represented in normalized format.
|
|
<DT id="8"><B>FP_NORMAL</B>
|
|
|
|
<DD>
|
|
if nothing of the above is correct then it must be a
|
|
normal floating-point number.
|
|
</DL>
|
|
<P>
|
|
|
|
The other macros provide a short answer to some standard questions.
|
|
<DL COMPACT>
|
|
<DT id="9"><B>isfinite(</B><I>x</I><B>)</B>
|
|
|
|
<DD>
|
|
returns a nonzero value if
|
|
<BR>
|
|
|
|
(fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
|
|
<DT id="10"><B>isnormal(</B><I>x</I><B>)</B>
|
|
|
|
<DD>
|
|
returns a nonzero value if
|
|
(fpclassify(x) == FP_NORMAL)
|
|
<DT id="11"><B>isnan(</B><I>x</I><B>)</B>
|
|
|
|
<DD>
|
|
returns a nonzero value if
|
|
(fpclassify(x) == FP_NAN)
|
|
<DT id="12"><B>isinf(</B><I>x</I><B>)</B>
|
|
|
|
<DD>
|
|
returns 1 if
|
|
<I>x</I>
|
|
|
|
is positive infinity, and -1 if
|
|
<I>x</I>
|
|
|
|
is negative infinity.
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>fpclassify</B>(),
|
|
|
|
<B>isfinite</B>(),
|
|
|
|
<B>isnormal</B>(),
|
|
|
|
<B>isnan</B>(),
|
|
|
|
<B>isinf</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
POSIX.1-2001, POSIX.1-2008, C99.
|
|
<P>
|
|
|
|
For
|
|
<B>isinf</B>(),
|
|
|
|
the standards merely say that the return value is nonzero
|
|
if and only if the argument has an infinite value.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
In glibc 2.01 and earlier,
|
|
<B>isinf</B>()
|
|
|
|
returns a nonzero value (actually: 1) if
|
|
<I>x</I>
|
|
|
|
is positive infinity or negative infinity.
|
|
(This is all that C99 requires.)
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+finite">finite</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+INFINITY">INFINITY</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+isgreater">isgreater</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+signbit">signbit</A></B>(3)
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="13"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="14"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="15"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="16"><A HREF="#lbAE">ATTRIBUTES</A><DD>
|
|
<DT id="17"><A HREF="#lbAF">CONFORMING TO</A><DD>
|
|
<DT id="18"><A HREF="#lbAG">NOTES</A><DD>
|
|
<DT id="19"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
<DT id="20"><A HREF="#lbAI">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:43 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|