Click here to Skip to main content
15,894,343 members
Articles / Desktop Programming / MFC

Genetic Algorithm Library

Rate me:
Please Sign up or sign in to vote.
4.93/5 (175 votes)
7 Apr 2012GPL358 min read 439.4K   34.7K   555  
A framework for genetic algorithms
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Genetic Algorithm Library: source/FPEqual.h File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.5 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>source/FPEqual.h File Reference</h1>This file contains declaration and implementation of functions that check floating point numbers for equalty. <a href="#_details">More...</a>
<p>
<code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &quot;<a class="el" href="_platform_8h.html">Platform.h</a>&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Namespaces</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">namespace &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_common.html">Common</a></td></tr>

<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="_f_p_equal_8h.html#824a7913d4fe679cf341133663fee189">FLOAT_AS_INT</a>(x)&nbsp;&nbsp;&nbsp;( ( *(int*)&amp;( x ) ) )</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This macro interprets <code>float</code> as <code>int</code> for easier bitwies access.  <a href="#824a7913d4fe679cf341133663fee189"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="_f_p_equal_8h.html#579112cb7d947b0190265bb9500bea32">DOUBLE_AS_LONGLONG</a>(x)&nbsp;&nbsp;&nbsp;( ( *(long long*)&amp;( x ) ) )</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This macro interprets <code>double</code> as <code>long long</code> for easier bitwies access.  <a href="#579112cb7d947b0190265bb9500bea32"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="_f_p_equal_8h.html#4661c0e2600fbef95791c5adf4ac937c">FLOAT_SIGN</a>&nbsp;&nbsp;&nbsp;0x80000000UL</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Extracts sign from single precision floating point number.  <a href="#4661c0e2600fbef95791c5adf4ac937c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="_f_p_equal_8h.html#66788aaf0a33977f25331a776270c6a9">DOUBLE_SIGN</a>&nbsp;&nbsp;&nbsp;0x8000000000000000ULL</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Extracts sign from double precision floating point number.  <a href="#66788aaf0a33977f25331a776270c6a9"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_common.html#c433896fbd9c2af1b6a8d7133c473911">Common::FloatsEqual</a> (float x, float y, int ulpTolerance=10)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method compares two single precision floating point numbers for equality with defined level of tolerance.  <a href="#c433896fbd9c2af1b6a8d7133c473911"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool GACALL&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_common.html#edca8f9f21710e27dc12d37089e822d4">Common::DoublesEqual</a> (double x, double y, int ulpTolerance=10)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method compares two double precision floating point numbers for equality with defined level of tolerance.  <a href="#edca8f9f21710e27dc12d37089e822d4"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This file contains declaration and implementation of functions that check floating point numbers for equalty. 
<p>
<hr><h2>Define Documentation</h2>
<a class="anchor" name="579112cb7d947b0190265bb9500bea32"></a><!-- doxytag: member="FPEqual.h::DOUBLE_AS_LONGLONG" ref="579112cb7d947b0190265bb9500bea32" args="(x)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define DOUBLE_AS_LONGLONG          </td>
          <td>(</td>
          <td class="paramtype">x&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%">&nbsp;&nbsp;&nbsp;( ( *(long long*)&amp;( x ) ) )</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This macro interprets <code>double</code> as <code>long long</code> for easier bitwies access. 
<p>

</div>
</div><p>
<a class="anchor" name="66788aaf0a33977f25331a776270c6a9"></a><!-- doxytag: member="FPEqual.h::DOUBLE_SIGN" ref="66788aaf0a33977f25331a776270c6a9" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define DOUBLE_SIGN&nbsp;&nbsp;&nbsp;0x8000000000000000ULL          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Extracts sign from double precision floating point number. 
<p>

</div>
</div><p>
<a class="anchor" name="824a7913d4fe679cf341133663fee189"></a><!-- doxytag: member="FPEqual.h::FLOAT_AS_INT" ref="824a7913d4fe679cf341133663fee189" args="(x)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define FLOAT_AS_INT          </td>
          <td>(</td>
          <td class="paramtype">x&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%">&nbsp;&nbsp;&nbsp;( ( *(int*)&amp;( x ) ) )</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
This macro interprets <code>float</code> as <code>int</code> for easier bitwies access. 
<p>

</div>
</div><p>
<a class="anchor" name="4661c0e2600fbef95791c5adf4ac937c"></a><!-- doxytag: member="FPEqual.h::FLOAT_SIGN" ref="4661c0e2600fbef95791c5adf4ac937c" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define FLOAT_SIGN&nbsp;&nbsp;&nbsp;0x80000000UL          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Extracts sign from single precision floating point number. 
<p>

</div>
</div><p>
</div>
<br/><a href="http://www.coolsoft-sd.com/ProductVersion.aspx?vid=9">Genetic Algorithm Library</a><br/><a href="http://www.coolsoft-sd.com/">Coolsoft Software Development</a>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer
Serbia Serbia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions