<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>TRIO</title>
<link href="trio.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.2.12 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> </center>
<hr><h1>Special Quantifies.</h1>Functions to detect and fabricate special quantities in floating-point numbers.
<a href="#_details">More...</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td nowrap align=right valign=top>double </td><td valign=bottom><a class="el" href="group___special_quantities.html#a1">trio_nzero</a> (void)</td></tr>
<tr><td> </td><td><font size=-1><em>Generate negative zero.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>double </td><td valign=bottom><a class="el" href="group___special_quantities.html#a2">trio_pinf</a> (void)</td></tr>
<tr><td> </td><td><font size=-1><em>Generate positive infinity.</em> <a href="#a2">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>double </td><td valign=bottom><a class="el" href="group___special_quantities.html#a3">trio_ninf</a> (void)</td></tr>
<tr><td> </td><td><font size=-1><em>Generate negative infinity.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>double </td><td valign=bottom><a class="el" href="group___special_quantities.html#a4">trio_nan</a> (void)</td></tr>
<tr><td> </td><td><font size=-1><em>Generate NaN.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group___special_quantities.html#a5">trio_isnan</a> (double number)</td></tr>
<tr><td> </td><td><font size=-1><em>Check for NaN.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group___special_quantities.html#a6">trio_isinf</a> (double number)</td></tr>
<tr><td> </td><td><font size=-1><em>Check for infinity.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group___special_quantities.html#a7">trio_isfinite</a> (double number)</td></tr>
<tr><td> </td><td><font size=-1><em>Check for finity.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group___special_quantities.html#a9">trio_signbit</a> (double number)</td></tr>
<tr><td> </td><td><font size=-1><em>Examine the sign of a number.</em> <a href="#a9">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group___special_quantities.html#a10">trio_fpclassify</a> (double number)</td></tr>
<tr><td> </td><td><font size=-1><em>Examine the class of a number.</em> <a href="#a10">More...</a><em></em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Functions to detect and fabricate special quantities in floating-point numbers.
<p>
<b>SYNOPSIS</b>
<p>
<div class="fragment"><pre>
cc ... -ltrio -lm
#include <trionan.h>
</pre></div>
<p>
<b>DESCRIPTION</b>
<p>
Certain arithmetical operations does not result in normal numbers. Instead they result in special quantities that must be handled differently by the floating-point hardware. These includes Infinity and Not-A-Number (NaN).
<p>
For example, 0/0 (zero divided by zero) yields NaN. Any operation which involves a NaN will result in NaN. Any comparison involving NaN will be unsuccessful, even if NaN is compared to NaN.
<p>
These special quantities are represented with special bit patterns by the floating-point hardware, and this bit patterns depend on the hardware. There may even be hardware that does not support special quantities, so the functions in this module are not guaranteed to work on all platforms.
<p>
The approach used in this module is to (in decreasing order of importance) <ul>
<li> Use C99 functionality when available. <li> Use IEEE 754-1985 bit patterns if possible. <li> Use platform-specific techniques.</ul>
<b>NOTES</b>
<p>
This module does not depend on the rest of trio, and can thus be reused separately. The following files are necessary: <ul>
<li> <code>triodef.h</code> <li> <code>trionan.h</code> <li> <code>trionan.c</code> </ul>
<hr><h2>Function Documentation</h2>
<a name="a10" doxytag="trionan.c::trio_fpclassify"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int trio_fpclassify </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">double </td>
<td class="mdname1" valign="top" nowrap> <em>number</em> </td>
<td class="md" valign="top">) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Examine the class of a number.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>number</em> </td><td>
An arbitrary floating-point number. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Enumerable value indicating the class of <code>number</code> </dl> </td>
</tr>
</table>
<a name="a7" doxytag="trionan.c::trio_isfinite"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int trio_isfinite </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">double </td>
<td class="mdname1" valign="top" nowrap> <em>number</em> </td>
<td class="md" valign="top">) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Check for finity.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>number</em> </td><td>
An arbitrary floating-point number. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating whether or not the number is a finite. </dl> </td>
</tr>
</table>
<a name="a6" doxytag="trionan.c::trio_isinf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int trio_isinf </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">double </td>
<td class="mdname1" valign="top" nowrap> <em>number</em> </td>
<td class="md" valign="top">) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Check for infinity.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>number</em> </td><td>
An arbitrary floating-point number. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
1 if positive infinity, -1 if negative infinity, 0 otherwise. </dl> </td>
</tr>
</table>
<a name="a5" doxytag="trionan.c::trio_isnan"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int trio_isnan </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">double </td>
<td class="mdname1" valign="top" nowrap> <em>number</em> </td>
<td class="md" valign="top">) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Check for NaN.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>number</em> </td><td>
An arbitrary floating-point number. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating whether or not the number is a NaN. </dl> </td>
</tr>
</table>
<a name="a4" doxytag="trionan.c::trio_nan"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> double trio_nan </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">void </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Generate NaN.
<p>
<dl compact><dt><b>
Returns: </b><dd>
Floating-point representation of NaN. </dl> </td>
</tr>
</table>
<a name="a3" doxytag="trionan.c::trio_ninf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> double trio_ninf </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">void </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Generate negative infinity.
<p>
<dl compact><dt><b>
Returns: </b><dd>
Floating-point value of negative infinity. </dl> </td>
</tr>
</table>
<a name="a1" doxytag="trionan.c::trio_nzero"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> double trio_nzero </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">void </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Generate negative zero.
<p>
<dl compact><dt><b>
Returns: </b><dd>
Floating-point representation of negative zero. </dl> </td>
</tr>
</table>
<a name="a2" doxytag="trionan.c::trio_pinf"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> double trio_pinf </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">void </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Generate positive infinity.
<p>
<dl compact><dt><b>
Returns: </b><dd>
Floating-point representation of positive infinity. </dl> </td>
</tr>
</table>
<a name="a9" doxytag="trionan.c::trio_signbit"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td class="md">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"> int trio_signbit </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">double </td>
<td class="mdname1" valign="top" nowrap> <em>number</em> </td>
<td class="md" valign="top">) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
<tr>
<td>
</td>
<td>
<p>
Examine the sign of a number.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>number</em> </td><td>
An arbitrary floating-point number. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating whether or not the number has the sign bit set (i.e. is negative). </dl> </td>
</tr>
</table>
<HR>
<center class="copyright">Copyright (C) 2001 Bjørn Reese and Daniel Stenberg.</center>
</body>
</html>