Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 3e60ff9d4d6f58c8fbd17208f14089fa > files > 291

octave-doc-3.2.3-3mdv2010.0.i586.rpm

<html lang="en">
<head>
<title>Numeric 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="prev" href="Data-Types.html#Data-Types" title="Data Types">
<link rel="next" href="Strings.html#Strings" title="Strings">
<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="Numeric-Data-Types"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Strings.html#Strings">Strings</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Data-Types.html#Data-Types">Data Types</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>

<h2 class="chapter">4 Numeric Data Types</h2>

<p><a name="index-numeric-constant-211"></a><a name="index-numeric-value-212"></a>
A <dfn>numeric constant</dfn> may be a scalar, a vector, or a matrix, and it
may contain complex values.

   <p>The simplest form of a numeric constant, a scalar, is a single number
that can be an integer, a decimal fraction, a number in scientific
(exponential) notation, or a complex number.  Note that by default numeric
constants are represented within Octave in double-precision floating
point format (complex constants are stored as pairs of double-precision
floating point values).  It is however possible to represent real
integers as described in <a href="Integer-Data-Types.html#Integer-Data-Types">Integer Data Types</a>.  Here are some
examples of real-valued numeric constants, which all have the same
value:

<pre class="example">     105
     1.05e+2
     1050e-1
</pre>
   <p>To specify complex constants, you can write an expression of the form

<pre class="example">     3 + 4i
     3.0 + 4.0i
     0.3e1 + 40e-1i
</pre>
   <p class="noindent">all of which are equivalent.  The letter &lsquo;<samp><span class="samp">i</span></samp>&rsquo; in the previous example
stands for the pure imaginary constant, defined as
  <code>sqrt (-1)</code>.

   <p>For Octave to recognize a value as the imaginary part of a complex
constant, a space must not appear between the number and the &lsquo;<samp><span class="samp">i</span></samp>&rsquo;. 
If it does, Octave will print an error message, like this:

<pre class="example">     octave:13&gt; 3 + 4 i
     
     parse error:
     
       syntax error
     
     &gt;&gt;&gt; 3 + 4 i
               ^
</pre>
   <p class="noindent">You may also use &lsquo;<samp><span class="samp">j</span></samp>&rsquo;, &lsquo;<samp><span class="samp">I</span></samp>&rsquo;, or &lsquo;<samp><span class="samp">J</span></samp>&rsquo; in place of the
&lsquo;<samp><span class="samp">i</span></samp>&rsquo; above.  All four forms are equivalent.

<!-- ov-re-mat.cc -->
   <p><a name="doc_002ddouble"></a>

<div class="defun">
&mdash; Built-in Function:  <b>double</b> (<var>x</var>)<var><a name="index-double-213"></a></var><br>
<blockquote><p>Convert <var>x</var> to double precision type. 
<!-- 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_002dsingle.html#doc_002dsingle">single</a>. 
</p></blockquote></div>

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

<div class="defun">
&mdash; Built-in Function:  <b>complex</b> (<var>x</var>)<var><a name="index-complex-214"></a></var><br>
&mdash; Built-in Function:  <b>complex</b> (<var>re, im</var>)<var><a name="index-complex-215"></a></var><br>
<blockquote><p>Return a complex result from real arguments.  With 1 real argument <var>x</var>,
return the complex result <var>x</var><code> + 0i</code>.  With 2 real arguments,
return the complex result <var>re</var><code> + </code><var>im</var>.  <code>complex</code> can
often be more convenient than expressions such as <code>a + i*b</code>. 
For example:

     <pre class="example">          complex ([1, 2], [3, 4])
          &rArr;
             1 + 3i   2 + 4i
</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_002dreal.html#doc_002dreal">real</a>, <a href="doc_002dimag.html#doc_002dimag">imag</a>, <a href="doc_002discomplex.html#doc_002discomplex">iscomplex</a>. 
</p></blockquote></div>

<ul class="menu">
<li><a accesskey="1" href="Matrices.html#Matrices">Matrices</a>
<li><a accesskey="2" href="Ranges.html#Ranges">Ranges</a>
<li><a accesskey="3" href="Single-Precision-Data-Types.html#Single-Precision-Data-Types">Single Precision Data Types</a>
<li><a accesskey="4" href="Integer-Data-Types.html#Integer-Data-Types">Integer Data Types</a>
<li><a accesskey="5" href="Bit-Manipulations.html#Bit-Manipulations">Bit Manipulations</a>
<li><a accesskey="6" href="Logical-Values.html#Logical-Values">Logical Values</a>
<li><a accesskey="7" href="Promotion-and-Demotion-of-Data-Types.html#Promotion-and-Demotion-of-Data-Types">Promotion and Demotion of Data Types</a>
<li><a accesskey="8" href="Predicates-for-Numeric-Objects.html#Predicates-for-Numeric-Objects">Predicates for Numeric Objects</a>
</ul>

   </body></html>