Real constants and functions: Difference between revisions

m
→‎{{header|Perl 6}}: Add tau, mention method forms, expand explanation a bit
(→‎{{header|Elm}}: Add, referencing http://package.elm-lang.org/packages/elm-lang/core/3.0.0/Basics)
m (→‎{{header|Perl 6}}: Add tau, mention method forms, expand explanation a bit)
Line 1,423:
=={{header|Perl 6}}==
<lang perl6>say e; # e
say piπ; # or pi # pi
say π,eτ; # or tau # if you prefer unicodetau
 
# Common mathmatical function are availble
# as subroutines and as numeric methods.
# It is a matter of personal taste and
# programming style as to which is used.
say sqrt 2; # Square root
say 2.sqrt; # Square root
 
# If you omit a base, does natural logarithm
say log 2; # Natural logarithm
say exp 422.log; # Exponentiation baseNatural elogarithm
 
# Specify a base if other than e
say log 4, 10; # Base 10 logarithm
say 4.log(10); # Base 10 logarithm
say 4.log10; # Convenience, base 10 only logarithm
 
say exp 7; # Exponentiation base e
say 7.exp; # Exponentiation base e
 
# Specify a base if other than e
say exp 7, 4; # Exponentiation
say 7.exp(4); # Exponentiation
say 4 ** 7; # Exponentiation
 
say abs -2; # Absolute value
say floor pi(-2).abs; # FloorAbsolute value
 
say floor -3.5; # Floor
say (-3.5).floor; # Floor
 
say ceiling pi; # Ceiling
say 4**7pi.ceiling; # Exponentiation</lang>Ceiling
 
say e ** π\i + 1 ≅ 0; # :-)</lang>
 
=={{header|PHP}}==
10,339

edits