Real constants and functions: Difference between revisions
Content added Content deleted
(added ocaml) |
(added perl and python) |
||
Line 43: | Line 43: | ||
ceil x;; (* ceiling *) |
ceil x;; (* ceiling *) |
||
x ** y; (* power *)</ocaml> |
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> |