Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > a3a677d80d3c0f62bd8cfbb738fb1e85 > files > 245

octave-doc-3.2.4-1mdv2010.1.x86_64.rpm

<html lang="en">
<head>
<title>Integer Data Types - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Numeric-Data-Types.html#Numeric-Data-Types" title="Numeric Data Types">
<link rel="prev" href="Single-Precision-Data-Types.html#Single-Precision-Data-Types" title="Single Precision Data Types">
<link rel="next" href="Bit-Manipulations.html#Bit-Manipulations" title="Bit Manipulations">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Integer-Data-Types"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Bit-Manipulations.html#Bit-Manipulations">Bit Manipulations</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Single-Precision-Data-Types.html#Single-Precision-Data-Types">Single Precision Data Types</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Numeric-Data-Types.html#Numeric-Data-Types">Numeric Data Types</a>
<hr>
</div>

<h3 class="section">4.4 Integer Data Types</h3>

<p>Octave supports integer matrices as an alternative to using double
precision.  It is possible to use both signed and unsigned integers
represented by 8, 16, 32, or 64 bits.  It should be noted that most
computations require floating point data, meaning that integers will
often change type when involved in numeric computations.  For this
reason integers are most often used to store data, and not for
calculations.

   <p>In general most integer matrices are created by casting
existing matrices to integers.  The following example shows how to cast
a matrix into 32 bit integers.

<pre class="example">     float = rand (2, 2)
          &rArr; float = 0.37569   0.92982
                     0.11962   0.50876
     integer = int32 (float)
          &rArr; integer = 0  1
                       0  1
</pre>
   <p class="noindent">As can be seen, floating point values are rounded to the nearest integer
when converted.

<!-- data.cc -->
   <p><a name="doc_002disinteger"></a>

<div class="defun">
&mdash; Built-in Function:  <b>isinteger</b> (<var>x</var>)<var><a name="index-isinteger-235"></a></var><br>
<blockquote><p>Return true if <var>x</var> is an integer object (int8, uint8, int16, etc.). 
Note that <code>isinteger (14)</code> is false because numeric constants in
Octave are double precision floating point values. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002disreal.html#doc_002disreal">isreal</a>, <a href="doc_002disnumeric.html#doc_002disnumeric">isnumeric</a>, <a href="doc_002dclass.html#doc_002dclass">class</a>, <a href="doc_002disa.html#doc_002disa">isa</a>. 
</p></blockquote></div>

<!-- ov-int8.cc -->
   <p><a name="doc_002dint8"></a>

<div class="defun">
&mdash; Built-in Function:  <b>int8</b> (<var>x</var>)<var><a name="index-int8-236"></a></var><br>
<blockquote><p>Convert <var>x</var> to 8-bit integer type. 
</p></blockquote></div>

<!-- ov-uint8.cc -->
   <p><a name="doc_002duint8"></a>

<div class="defun">
&mdash; Built-in Function:  <b>uint8</b> (<var>x</var>)<var><a name="index-uint8-237"></a></var><br>
<blockquote><p>Convert <var>x</var> to unsigned 8-bit integer type. 
</p></blockquote></div>

<!-- ov-int16.cc -->
   <p><a name="doc_002dint16"></a>

<div class="defun">
&mdash; Built-in Function:  <b>int16</b> (<var>x</var>)<var><a name="index-int16-238"></a></var><br>
<blockquote><p>Convert <var>x</var> to 16-bit integer type. 
</p></blockquote></div>

<!-- ov-uint16.cc -->
   <p><a name="doc_002duint16"></a>

<div class="defun">
&mdash; Built-in Function:  <b>uint16</b> (<var>x</var>)<var><a name="index-uint16-239"></a></var><br>
<blockquote><p>Convert <var>x</var> to unsigned 16-bit integer type. 
</p></blockquote></div>

<!-- ov-int32.cc -->
   <p><a name="doc_002dint32"></a>

<div class="defun">
&mdash; Built-in Function:  <b>int32</b> (<var>x</var>)<var><a name="index-int32-240"></a></var><br>
<blockquote><p>Convert <var>x</var> to 32-bit integer type. 
</p></blockquote></div>

<!-- ov-uint32.cc -->
   <p><a name="doc_002duint32"></a>

<div class="defun">
&mdash; Built-in Function:  <b>uint32</b> (<var>x</var>)<var><a name="index-uint32-241"></a></var><br>
<blockquote><p>Convert <var>x</var> to unsigned 32-bit integer type. 
</p></blockquote></div>

<!-- ov-int64.cc -->
   <p><a name="doc_002dint64"></a>

<div class="defun">
&mdash; Built-in Function:  <b>int64</b> (<var>x</var>)<var><a name="index-int64-242"></a></var><br>
<blockquote><p>Convert <var>x</var> to 64-bit integer type. 
</p></blockquote></div>

<!-- ov-uint64.cc -->
   <p><a name="doc_002duint64"></a>

<div class="defun">
&mdash; Built-in Function:  <b>uint64</b> (<var>x</var>)<var><a name="index-uint64-243"></a></var><br>
<blockquote><p>Convert <var>x</var> to unsigned 64-bit integer type. 
</p></blockquote></div>

<!-- bitfcns.cc -->
   <p><a name="doc_002dintmax"></a>

<div class="defun">
&mdash; Built-in Function:  <b>intmax</b> (<var>type</var>)<var><a name="index-intmax-244"></a></var><br>
<blockquote><p>Return the largest integer that can be represented in an integer type. 
The variable <var>type</var> can be

          <dl>
<dt><code>int8</code><dd>signed 8-bit integer. 
<br><dt><code>int16</code><dd>signed 16-bit integer. 
<br><dt><code>int32</code><dd>signed 32-bit integer. 
<br><dt><code>int64</code><dd>signed 64-bit integer. 
<br><dt><code>uint8</code><dd>unsigned 8-bit integer. 
<br><dt><code>uint16</code><dd>unsigned 16-bit integer. 
<br><dt><code>uint32</code><dd>unsigned 32-bit integer. 
<br><dt><code>uint64</code><dd>unsigned 64-bit integer. 
</dl>

        <p>The default for <var>type</var> is <code>uint32</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dintmin.html#doc_002dintmin">intmin</a>, <a href="doc_002dbitmax.html#doc_002dbitmax">bitmax</a>. 
</p></blockquote></div>

<!-- bitfcns.cc -->
   <p><a name="doc_002dintmin"></a>

<div class="defun">
&mdash; Built-in Function:  <b>intmin</b> (<var>type</var>)<var><a name="index-intmin-245"></a></var><br>
<blockquote><p>Return the smallest integer that can be represented in an integer type. 
The variable <var>type</var> can be

          <dl>
<dt><code>int8</code><dd>signed 8-bit integer. 
<br><dt><code>int16</code><dd>signed 16-bit integer. 
<br><dt><code>int32</code><dd>signed 32-bit integer. 
<br><dt><code>int64</code><dd>signed 64-bit integer. 
<br><dt><code>uint8</code><dd>unsigned 8-bit integer. 
<br><dt><code>uint16</code><dd>unsigned 16-bit integer. 
<br><dt><code>uint32</code><dd>unsigned 32-bit integer. 
<br><dt><code>uint64</code><dd>unsigned 64-bit integer. 
</dl>

        <p>The default for <var>type</var> is <code>uint32</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dintmax.html#doc_002dintmax">intmax</a>, <a href="doc_002dbitmax.html#doc_002dbitmax">bitmax</a>. 
</p></blockquote></div>

<!-- ./miscellaneous/intwarning.m -->
   <p><a name="doc_002dintwarning"></a>

<div class="defun">
&mdash; Function File:  <b>intwarning</b> (<var>action</var>)<var><a name="index-intwarning-246"></a></var><br>
&mdash; Function File:  <b>intwarning</b> (<var>s</var>)<var><a name="index-intwarning-247"></a></var><br>
&mdash; Function File: <var>s</var> = <b>intwarning</b> (<var><small class="dots">...</small></var>)<var><a name="index-intwarning-248"></a></var><br>
<blockquote><p>Control the state of the warning for integer conversions and math
operations.

          <dl>
<dt>"query"<dd>The state of the Octave integer conversion and math warnings is
queried.  If there is no output argument, then the state is printed. 
Otherwise it is returned in a structure with the fields "identifier"
and "state".

          <!-- Set example in small font to prevent overfull line -->
          <pre class="smallexample">               intwarning ("query")
               The state of warning "Octave:int-convert-nan" is "off"
               The state of warning "Octave:int-convert-non-int-val" is "off"
               The state of warning "Octave:int-convert-overflow" is "off"
               The state of warning "Octave:int-math-overflow" is "off"
</pre>
          <br><dt>"on"<dd>Turn integer conversion and math warnings "on".  If there is no output
argument, then nothing is printed.  Otherwise the original state of
the state of the integer conversion and math warnings is returned in
a structure array.

          <br><dt>"off"<dd>Turn integer conversion and math warnings "on".  If there is no output
argument, then nothing is printed.  Otherwise the original state of
the state of the integer conversion and math warnings is returned in
a structure array. 
</dl>

        <p>The original state of the integer warnings can be restored by passing
the structure array returned by <code>intwarning</code> to a later call to
<code>intwarning</code>.  For example

     <pre class="example">          s = intwarning ("off");
          ...
          intwarning (s);
</pre>
        <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dwarning.html#doc_002dwarning">warning</a>. 
</p></blockquote></div>

<ul class="menu">
<li><a accesskey="1" href="Integer-Arithmetic.html#Integer-Arithmetic">Integer Arithmetic</a>
</ul>

   </body></html>