<?php $isip_window_title = "ISIP Homepage"; ?>
<?php include("/data/isip/www/templates/documentation/header/header.html"); ?>

<!--#set var="isip_page_title" value="Float" -->
<?php include("/data/isip/www/templates/documentation/body/index_class.html"); ?>
<?php include("/data/isip/www/templates/documentation/body/bar.html"); ?>

<a name="name">
<b>name: <a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/Float.h">Float</a>:  public  <a href="../MScalar/index.html">MScalar&lt;float, float32&gt;</a></b>

<br><br>

<a name="synopsis">
<b>synopsis:</b>
<br><br>

<blockquote>
<pre>
g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_math_scalar.a

#include &lt;Float.h&gt;

Float(float arg = DEF_VALUE);
Float(const Float& arg);
</pre>
</blockquote>

<a name="quick_start">
<b>quick start:</b>
<br><br>

<blockquote>
<pre>
Float val0;
val0 = 10.0;

Float val1(5.0);
Float val2;

val2 = val0.exp10(2.0) + val1.pow(3.0);
</pre>
</blockquote>

<a name="description"> 
<b>description:</b>
<br><br>

The Float class manages 32-bit float numbers. It is derived from the
<a href="../MScalar/index.html">MScalar</a> class and inherits 
commonly-used mathematical, logical, DSP
and i/o methods from it. A Float object can read itself from (or write
itself to) a Sof file. It includes the memory management methods which
use the MemoryManager class to allocate or delete memory from the heap.

<br><br>

<a name="dependencies">
<b>dependencies:</b>
<br><br>
<ul>
  <li>
       <a href="../MScalar/index.html">MScalar</a>
</ul>

<a name="constants">
<b>public constants:</b>
<br><br>

<ul>
  <li> define the class name:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/flt_00.cc&constant=CLASS_NAME">static const String CLASS_NAME = L"Float";</a></pre>
</ul>

<a name="error">
<b>error codes:</b>
<br><br>

<ul>
  <li> error code indicating Float class general error:
       
       <pre><a href="/perl/ifc_document.pl?err=00021000">static const long ERR = 21000;</a></pre>
</ul>

<a name="protected">
<b>protected data:</b>
<br><br>

<ul>
  <li> static memory manager:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/flt_00.cc&static=mgr_d">static MemoryManager mgr_d;</a></pre>
</ul>

<a name="public">
<b>required public methods:</b>
<br><br>

<ul>
  <li> static methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/Float.h&method=name">static const String& name();</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/flt_02.cc&method=diagnose">static boolean diagnose(Integral::DEBUG debug_level);</a></pre>

  <li> debug methods:
       
       <pre>setDebug is inherited from the <a href="../MScalar/index.html#public:debug">MScalar</a> template class</pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/flt_01.cc&method=debug">boolean debug(const unichar* message) const;</a></pre>

  <li> destructor/constructor(s):
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/Float.h&method=destructor">~Float();</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/Float.h&method=default constructor">Float(float arg = DEF_VALUE);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/Float.h&method=copy constructor">Float(const Float& arg);</a></pre>     

  <li> assign methods:
       
 <pre>assign methods are inherited from the <a href="../MScalar/index.html#public:assign">MScalar</a> template class</pre>

  <li> operator= methods:
       
      <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/Float.h&method=operator%3D&instance=0">Float& operator= (const Float& arg);</a></pre>
       
  <li> i/o methods:

         <pre>the sofSize method is inherited from the <a href="../MScalar/index.html#public:io">MScalar</a> template class</pre> 
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float//Float.h&method=read">boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float///Float.h&method=write">boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;</a></pre>
       <pre>readData and writeData are inherited from the <a href="../MScalar/index.html#public:io">MScalar</a> template class</pre>
       
  <li> equality methods:
       
 <pre>equality methods are inherited from the <a href="../MScalar/index.html#public:equality">MScalar</a> template class</pre>
       
  <li> memory management methods:
       
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/Float.h&method=new">static void* operator new(size_t size);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/Float.h&method=new[]">static void* operator new[](size_t size);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/Float.h&method=delete">static void operator delete(void* ptr);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/Float.h&method=delete[]">static void operator delete[](void* ptr);</a></pre>
       <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/Float.h&method=setGrowSize">static boolean setGrowSize(long grow_size);</a></pre>
       <pre>clear is inherited from the <a href="../MScalar/index.html#public:memory">MScalar</a> template class</pre>
     </ul>

<a name="specific">
<b>class-specific public methods:</b>
<br><br>

<ul>
  <li> operator overload methods:
       
      <pre><a href="/perl/ifc_document.pl?file=$isip/class/math/scalar/Float/Float.h&method=operator%3D&instance=1">Float& operator= (float arg);</a></pre>
</ul>
  
<a name="private">
<b>private methods:</b>

<ul>
  <li> bitwise methods: declare these as private member functions because they
       are not defined for floating point operations

       <pre>float bor(float, float);</pre>
       <pre>float band(float, float);</pre>
       <pre>float bxor(float, float);</pre>
       <pre>float brs(float, float);</pre>
       <pre>float bls(float, float);</pre>
       <pre>float bcmpl(float);</pre>

  <li> modulus methods: declare these as private member functions because they
       are not defined for floating point operations

       <pre>float mod(float, float);</pre>
       <pre>float& operator%= (float);</pre>
       <pre>float& operator% (float);</pre>
</ul>

<a name="examples">
<b>examples:</b>
<br><br>

<ul>
  <li> This example shows how to write a Float object into a Sof file:
       
<pre>
Float val0(5.0);
String tmp_filename(L"foo");
Sof tmp_file;
tmp_file.open(tmp_filename, File::WRITE_ONLY, File::TEXT);
       
val0.write(tmp_file, (long)0);
tmp_file.close();</pre>

  <li> This example shows how to generate a random number:
       
<pre>
Float rand_num;
float value;
float value1;
       
// using default seed
//
value = rand_num.randSeed();
     
// Gaussian random number generation
//
float mean = 5.0;
float std_dev = 3.0;
value1 = rand_num.grand(mean, std_dev);</pre>
</ul>

<a name="notes">
<b>notes:</b>
<br><br>

<ul>
  <li> See the
       <a href="../MScalar/index.html#notes">notes section of MScalar</a>.

       <br><br>
       
  <li> The Float class defines the bor, band, bxor, brs, bls, bcmpl,
       mod, operator%= and operator% integer methods as private to block the
       templatized functions in MScalar<float,float32>. So if a user attempts
       to use Float::mod() they will get a compilation error rather
       than a runtime error.
</ul>

<!--#include virtual="/hse/ies/templates/documentation/footer/footer.html" -->






