Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > 19bb6433bb07a8b16410504336791904 > files > 10

ocaml-doc-3.06-5mdk.ppc.rpm

<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="Start" href="index.html">
<link rel="previous" href="ArrayLabels.html">
<link rel="next" href="Bigarray.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Arg" rel="Chapter" href="Arg.html">
<link title="Arith_status" rel="Chapter" href="Arith_status.html">
<link title="Array" rel="Chapter" href="Array.html">
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
<link title="Big_int" rel="Chapter" href="Big_int.html">
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
<link title="Buffer" rel="Chapter" href="Buffer.html">
<link title="Callback" rel="Chapter" href="Callback.html">
<link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html">
<link title="Char" rel="Chapter" href="Char.html">
<link title="Complex" rel="Chapter" href="Complex.html">
<link title="Condition" rel="Chapter" href="Condition.html">
<link title="Dbm" rel="Chapter" href="Dbm.html">
<link title="Digest" rel="Chapter" href="Digest.html">
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
<link title="Event" rel="Chapter" href="Event.html">
<link title="Filename" rel="Chapter" href="Filename.html">
<link title="Format" rel="Chapter" href="Format.html">
<link title="Gc" rel="Chapter" href="Gc.html">
<link title="Genlex" rel="Chapter" href="Genlex.html">
<link title="Graphics" rel="Chapter" href="Graphics.html">
<link title="GraphicsX11" rel="Chapter" href="GraphicsX11.html">
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
<link title="Int32" rel="Chapter" href="Int32.html">
<link title="Int64" rel="Chapter" href="Int64.html">
<link title="Lazy" rel="Chapter" href="Lazy.html">
<link title="Lexing" rel="Chapter" href="Lexing.html">
<link title="List" rel="Chapter" href="List.html">
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
<link title="Map" rel="Chapter" href="Map.html">
<link title="Marshal" rel="Chapter" href="Marshal.html">
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
<link title="Mutex" rel="Chapter" href="Mutex.html">
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
<link title="Num" rel="Chapter" href="Num.html">
<link title="Obj" rel="Chapter" href="Obj.html">
<link title="Oo" rel="Chapter" href="Oo.html">
<link title="Parsing" rel="Chapter" href="Parsing.html">
<link title="Pervasives" rel="Chapter" href="Pervasives.html">
<link title="Printexc" rel="Chapter" href="Printexc.html">
<link title="Printf" rel="Chapter" href="Printf.html">
<link title="Queue" rel="Chapter" href="Queue.html">
<link title="Random" rel="Chapter" href="Random.html">
<link title="Scanf" rel="Chapter" href="Scanf.html">
<link title="Set" rel="Chapter" href="Set.html">
<link title="Sort" rel="Chapter" href="Sort.html">
<link title="Stack" rel="Chapter" href="Stack.html">
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
<link title="Str" rel="Chapter" href="Str.html">
<link title="Stream" rel="Chapter" href="Stream.html">
<link title="String" rel="Chapter" href="String.html">
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
<link title="Sys" rel="Chapter" href="Sys.html">
<link title="Thread" rel="Chapter" href="Thread.html">
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
<link title="Tk" rel="Chapter" href="Tk.html">
<link title="Unix" rel="Chapter" href="Unix.html">
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
<link title="Weak" rel="Chapter" href="Weak.html"><link title="Arithmetic operations" rel="Section" href="#6_Arithmeticoperations">
<link title="Comparisons and tests" rel="Section" href="#6_Comparisonsandtests">
<link title="Conversions to and from strings" rel="Section" href="#6_Conversionstoandfromstrings">
<link title="Conversions to and from other numerical types" rel="Section" href="#6_Conversionstoandfromothernumericaltypes">
<title>Big_int</title>
</head>
<body>
<div class="navbar"><a href="ArrayLabels.html">Previous</a>
&nbsp;<a href="index.html">Up</a>
&nbsp;<a href="Bigarray.html">Next</a>
</div>
<center><h1>Module <a href="type_Big_int.html">Big_int</a></h1></center>
<br>
<pre><span class="keyword">module</span> Big_int: <code class="type">sig  end</code></pre><div class="info">
Operations on arbitrary-precision integers.
<p>

   Big integers (type <code class="code">big_int</code>) are signed integers of arbitrary size.<br>
</div>
<hr width="100%">
<br><code><span class="keyword">type</span> <a name="TYPEbig_int"></a>big_int </code>
<div class="info">
The type of big integers.<br>
</div>
<br>
<pre><span class="keyword">val</span> <a name="VALzero_big_int"></a>zero_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
The big integer <code class="code">0</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALunit_big_int"></a>unit_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
The big integer <code class="code">1</code>.<br>
</div>
<br>
<br>
<a name="6_Arithmeticoperations"></a>
<table cellpadding=5 cellspacing=5 width="100%">
<tr class="title6"><td><div align=center>
<span class="title6">Arithmetic operations</span>
</div>
</td>
</tr>
</table>
<br><br>
<pre><span class="keyword">val</span> <a name="VALminus_big_int"></a>minus_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Unary negation.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALabs_big_int"></a>abs_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Absolute value.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALadd_big_int"></a>add_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Addition.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALsucc_big_int"></a>succ_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Successor (add 1).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALadd_int_big_int"></a>add_int_big_int : <code class="type">int -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Addition of a small integer to a big integer.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALsub_big_int"></a>sub_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Subtraction.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALpred_big_int"></a>pred_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Predecessor (subtract 1).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALmult_big_int"></a>mult_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Multiplication of two big integers.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALmult_int_big_int"></a>mult_int_big_int : <code class="type">int -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Multiplication of a big integer by a small integer<br>
</div>
<pre><span class="keyword">val</span> <a name="VALsquare_big_int"></a>square_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Return the square of the given big integer<br>
</div>
<pre><span class="keyword">val</span> <a name="VALsqrt_big_int"></a>sqrt_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
<code class="code">sqrt_big_int a</code> returns the integer square root of <code class="code">a</code>,
           that is, the largest big integer <code class="code">r</code> such that <code class="code">r * r &lt;= a</code>.
           Raise <code class="code"><span class="constructor">Invalid_argument</span></code> if <code class="code">a</code> is negative.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALquomod_big_int"></a>quomod_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> * <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Euclidean division of two big integers.
           The first part of the result is the quotient,
           the second part is the remainder.
           Writing <code class="code">(q,r) = quomod_big_int a b</code>, we have
           <code class="code">a = q * b + r</code> and <code class="code">0 &lt;= r &lt; <span class="keywordsign">|</span>b<span class="keywordsign">|</span></code>.
           Raise <code class="code"><span class="constructor">Division_by_zero</span></code> if the divisor is zero.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALdiv_big_int"></a>div_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Euclidean quotient of two big integers.
           This is the first result <code class="code">q</code> of <code class="code">quomod_big_int</code> (see above).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALmod_big_int"></a>mod_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Euclidean modulus of two big integers.
           This is the second result <code class="code">r</code> of <code class="code">quomod_big_int</code> (see above).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALgcd_big_int"></a>gcd_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Greatest common divisor of two big integers.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALpower_int_positive_int"></a>power_int_positive_int : <code class="type">int -> int -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><pre><span class="keyword">val</span> <a name="VALpower_big_int_positive_int"></a>power_big_int_positive_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> int -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><pre><span class="keyword">val</span> <a name="VALpower_int_positive_big_int"></a>power_int_positive_big_int : <code class="type">int -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><pre><span class="keyword">val</span> <a name="VALpower_big_int_positive_big_int"></a>power_big_int_positive_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Exponentiation functions.  Return the big integer
           representing the first argument <code class="code">a</code> raised to the power <code class="code">b</code>
           (the second argument).  Depending
           on the function, <code class="code">a</code> and <code class="code">b</code> can be either small integers
           or big integers.  Raise <code class="code"><span class="constructor">Invalid_argument</span></code> if <code class="code">b</code> is negative.<br>
</div>
<br>
<br>
<a name="6_Comparisonsandtests"></a>
<table cellpadding=5 cellspacing=5 width="100%">
<tr class="title6"><td><div align=center>
<span class="title6">Comparisons and tests</span>
</div>
</td>
</tr>
</table>
<br><br>
<pre><span class="keyword">val</span> <a name="VALsign_big_int"></a>sign_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> int</code></pre><div class="info">
Return <code class="code">0</code> if the given big integer is zero,
           <code class="code">1</code> if it is positive, and <code class="code">-1</code> if it is negative.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALcompare_big_int"></a>compare_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> int</code></pre><div class="info">
<code class="code">compare_big_int a b</code> returns <code class="code">0</code> if <code class="code">a</code> and <code class="code">b</code> are equal,
           <code class="code">1</code> if <code class="code">a</code> is greater than <code class="code">b</code>, and <code class="code">-1</code> if <code class="code">a</code> is smaller
           than <code class="code">b</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALeq_big_int"></a>eq_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> bool</code></pre><pre><span class="keyword">val</span> <a name="VALle_big_int"></a>le_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> bool</code></pre><pre><span class="keyword">val</span> <a name="VALge_big_int"></a>ge_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> bool</code></pre><pre><span class="keyword">val</span> <a name="VALlt_big_int"></a>lt_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> bool</code></pre><pre><span class="keyword">val</span> <a name="VALgt_big_int"></a>gt_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> bool</code></pre><div class="info">
Usual boolean comparisons between two big integers.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALmax_big_int"></a>max_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Return the greater of its two arguments.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALmin_big_int"></a>min_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a> -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Return the smaller of its two arguments.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALnum_digits_big_int"></a>num_digits_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> int</code></pre><div class="info">
Return the number of machine words used to store the
           given big integer.<br>
</div>
<br>
<br>
<a name="6_Conversionstoandfromstrings"></a>
<table cellpadding=5 cellspacing=5 width="100%">
<tr class="title6"><td><div align=center>
<span class="title6">Conversions to and from strings</span>
</div>
</td>
</tr>
</table>
<br><br>
<pre><span class="keyword">val</span> <a name="VALstring_of_big_int"></a>string_of_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> string</code></pre><div class="info">
Return the string representation of the given big integer,
           in decimal (base 10).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALbig_int_of_string"></a>big_int_of_string : <code class="type">string -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Convert a string to a big integer, in decimal.
           The string consists of an optional <code class="code">-</code> or <code class="code">+</code> sign,
           followed by one or several decimal digits.<br>
</div>
<br>
<br>
<a name="6_Conversionstoandfromothernumericaltypes"></a>
<table cellpadding=5 cellspacing=5 width="100%">
<tr class="title6"><td><div align=center>
<span class="title6">Conversions to and from other numerical types</span>
</div>
</td>
</tr>
</table>
<br><br>
<pre><span class="keyword">val</span> <a name="VALbig_int_of_int"></a>big_int_of_int : <code class="type">int -> <a href="Big_int.html#TYPEbig_int">big_int</a></code></pre><div class="info">
Convert a small integer to a big integer.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALis_int_big_int"></a>is_int_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> bool</code></pre><div class="info">
Test whether the given big integer is small enough to
           be representable as a small integer (type <code class="code">int</code>)
           without loss of precision.  On a 32-bit platform,
           <code class="code">is_int_big_int a</code> returns <code class="code"><span class="keyword">true</span></code> if and only if
           <code class="code">a</code> is between 2<sup class="superscript">30</sup> and 2<sup class="superscript">30</sup>-1.  On a 64-bit platform,
           <code class="code">is_int_big_int a</code> returns <code class="code"><span class="keyword">true</span></code> if and only if
           <code class="code">a</code> is between -2<sup class="superscript">62</sup> and 2<sup class="superscript">62</sup>-1.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALint_of_big_int"></a>int_of_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> int</code></pre><div class="info">
Convert a big integer to a small integer (type <code class="code">int</code>).
           Raises <code class="code"><span class="constructor">Failure</span> <span class="string">"int_of_big_int"</span></code> if the big integer
           is not representable as a small integer.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALfloat_of_big_int"></a>float_of_big_int : <code class="type"><a href="Big_int.html#TYPEbig_int">big_int</a> -> float</code></pre><div class="info">
Returns a floating-point number approximating the
           given big integer.<br>
</div>
</body></html>