Jump to content

Real constants and functions: Difference between revisions

no edit summary
(→‎{{header|Perl}}: Added examples and reformatted a bit)
No edit summary
Line 203:
ceil(x); //ceiling
pow(x,y); //power</php>
 
=={{header|Pop11}}==
 
<pre>
pi ;;; Number Pi
sqrt(x) ;;; Square root
log(x) ;;; Natural logarithm
exp(x) ;;; Exponential function
abs(x) ;;; Absolute value
x ** y ;;; x to the power y
</pre>
 
The number e is not provided directly, one has to compute 'exp(1)'
instead. Also, floor and ceiling are not provided, one can
define them using integer part:
 
<pre>
define floor(x);
if x < 0 then
-intof(x);
else
intof(x);
endif;
enddefine;
 
define ceiling(x);
-floor(-x);
enddefine;
</pre>
 
=={{header|Python}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.