Anonymous user
Real constants and functions: Difference between revisions
added perl and python
(added ocaml) |
(added perl and python) |
||
Line 43:
ceil x;; (* ceiling *)
x ** y; (* power *)</ocaml>
=={{header|Perl}}==
<perl>use POSIX;
sqrt(x); #square root
log(x); #natural logarithm
exp(x); #exponential
abs(x); #absolute value
POSIX::floor(x); #floor
POSIX::ceil(x); #ceiling
x ** y; #power</perl>
=={{header|Python}}==
<python>import math
math.e #e
math.pi #pi
math.sqrt(x) #square root
math.log(x) #natural logarithm--log base 10 also available (math.log10)
math.exp(x) #exponential
abs(x) #absolute value
math.floor(x) #floor
math.ceil(x) #ceiling
x ** y #power</python>
|