Real constants and functions: Difference between revisions

Line 180:
Math constants and functions are as outlined in the [[#Java Java]] example, except as follows:
 
====='''Absolute Value====='''<br/>
In addition to the java.lang.Math.abs() method, each numeric type has an abs() method, which can be invoked directly on the number:
<lang groovy>println ((-22).abs())</lang>
Line 186:
<pre>22</pre>
 
====='''Power====='''<br/>
In addition to the java.lang.Math.pow() method, each numeric type works with the power operator (**), which can be invoked as an in-fix operator between two numbers:
<lang groovy>println 22**3.5</lang>
Line 197:
<pre>NaN</pre>
 
Also note that at the moment (2009-05-21:58, 24 May 2009 (UTC)) Groovy (1.6.2) gives a mathematically incorrect result for "0**0". The correct result should be "NaN", but the Groovy operation result is "1".
 
=={{header|Haskell}}==
Anonymous user