<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Got it. No doubt some of this figures into why I was beaten bloody by ghci last night. Is there a number "tree" somewhere that shows the heirarchy?<br><br>Michael<br><br>--- On <b>Mon, 10/26/09, Daniel Fischer <i>&lt;daniel.is.fischer@web.de&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Daniel Fischer &lt;daniel.is.fischer@web.de&gt;<br>Subject: Re: [Haskell-cafe] Fortran mixed mode arithmetic expressions -&gt; Haskell<br>To: "michael rice" &lt;nowgate@yahoo.com&gt;, haskell-cafe@haskell.org<br>Date: Monday, October 26, 2009, 1:09 PM<br><br><div class="plainMail">Am Monday 26 October 2009 17:24:46 schrieben Sie:<br>&gt; Being new to Haskell, I take it (^) and (^^) would be the preferred<br>&gt; exponential "operator." When (how,where,why) would one use (**)?<br><br>The beasts
 have different types and are for different things:<br>Prelude&gt; :i (^)<br>(^) :: (Num a, Integral b) =&gt; a -&gt; b -&gt; a&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;-- Defined in GHC.Real<br>infixr 8 ^<br><br>This one raises any number to a nonnegative integral power.<br>A typical implementation would be power by repeated squaring.<br><br>Prelude&gt; :i (^^)<br>(^^) :: (Fractional a, Integral b) =&gt; a -&gt; b -&gt; a<br>&nbsp; &nbsp; &nbsp; &nbsp; -- Defined in GHC.Real<br>infixr 8 ^^<br><br>This one allows also negative powers, so the type of base must allow inversion, hence it <br>must belong to Fractional. The exponent must still be an integer, you can't use this for <br>n-th roots or similar.<br>A typical implementation would be power by repeated squaring, followed by (1/) if the <br>exponent is negative.<br><br>Prelude&gt; :i (**)<br>class (Fractional a) =&gt; Floating a where<br>&nbsp; ...<br>&nbsp; (**) :: a -&gt; a -&gt; a<br>&nbsp; ...<br>&nbsp;
 &nbsp; &nbsp; &nbsp; -- Defined in GHC.Float<br>infixr 8 **<br><br>This one raises a floating point number to an arbitrary power, so you can use it for n-th <br>roots.<br>A typical implementation would be<br>b ** e = exp (e*log b).<br><br></div></blockquote></td></tr></table><br>