<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.10">
<title>MLtonReal</title>
<link rel="stylesheet" href="./asciidoc.css" type="text/css">
<link rel="stylesheet" href="./pygments.css" type="text/css">


<script type="text/javascript" src="./asciidoc.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
asciidoc.install();
/*]]>*/
</script>
<link rel="stylesheet" href="./mlton.css" type="text/css">
</head>
<body class="article">
<div id="banner">
<div id="banner-home">
<a href="./Home">MLton 20201002</a>
</div>
</div>
<div id="header">
<h1>MLtonReal</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span></span><span class="k">signature</span><span class="w"> </span><span class="n">MLTON_REAL</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">   </span><span class="k">sig</span><span class="w"></span>
<span class="w">      </span><span class="k">type</span><span class="w"> </span><span class="n">t</span><span class="w"></span>

<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">fromWord</span><span class="p">:</span><span class="w"> </span><span class="n">word</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">t</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">fromLargeWord</span><span class="p">:</span><span class="w"> </span><span class="n">LargeWord</span><span class="p">.</span><span class="n">word</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">t</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">toWord</span><span class="p">:</span><span class="w"> </span><span class="n">IEEEReal</span><span class="p">.</span><span class="n">rounding_mode</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">word</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">toLargeWord</span><span class="p">:</span><span class="w"> </span><span class="n">IEEEReal</span><span class="p">.</span><span class="n">rounding_mode</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">LargeWord</span><span class="p">.</span><span class="n">word</span><span class="w"></span>
<span class="w">   </span><span class="k">end</span><span class="w"></span>
</pre></div></div></div>
<div class="ulist"><ul>
<li>
<p>
<span class="monospaced">type t</span>
</p>
<div class="paragraph"><p>the type of reals.  For <span class="monospaced">MLton.LargeReal</span> this is <span class="monospaced">LargeReal.real</span>,
for <span class="monospaced">MLton.Real</span> this is <span class="monospaced">Real.real</span>, for <span class="monospaced">MLton.Real32</span> this is
<span class="monospaced">Real32.real</span>, for <span class="monospaced">MLton.Real64</span> this is <span class="monospaced">Real64.real</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">fromWord w</span>
</p>
</li>
<li>
<p>
<span class="monospaced">fromLargeWord w</span>
</p>
<div class="paragraph"><p>convert the word <span class="monospaced">w</span> to a real value.  If the value of <span class="monospaced">w</span> is larger
than (the appropriate) <span class="monospaced">REAL.maxFinite</span>, then infinity is returned.
If <span class="monospaced">w</span> cannot be exactly represented as a real value, then the current
rounding mode is used to determine the resulting value.</p></div>
</li>
<li>
<p>
<span class="monospaced">toWord mode r</span>
</p>
</li>
<li>
<p>
<span class="monospaced">toLargeWord mode r</span>
</p>
<div class="paragraph"><p>convert the argument <span class="monospaced">r</span> to a word type using the specified rounding
mode. They raise <span class="monospaced">Overflow</span> if the result is not representable, in
particular, if <span class="monospaced">r</span> is an infinity. They raise <span class="monospaced">Domain</span> if <span class="monospaced">r</span> is NaN.</p></div>
</li>
<li>
<p>
<span class="monospaced">MLton.Real32.castFromWord w</span>
</p>
</li>
<li>
<p>
<span class="monospaced">MLton.Real64.castFromWord w</span>
</p>
<div class="paragraph"><p>convert the argument <span class="monospaced">w</span> to a real type as a bit-wise cast.</p></div>
</li>
<li>
<p>
<span class="monospaced">MLton.Real32.castToWord r</span>
</p>
</li>
<li>
<p>
<span class="monospaced">MLton.Real64.castToWord r</span>
</p>
<div class="paragraph"><p>convert the argument <span class="monospaced">r</span> to a word type as a bit-wise cast.</p></div>
</li>
</ul></div>
</div>
</div>
</div>
<div id="footnotes"><hr></div>
<div id="footer">
<div id="footer-text">
</div>
<div id="footer-badges">
</div>
</div>
</body>
</html>
