maths |
Discworld player help |
maths |
Name
maths - Do arithmetic
Syntax
maths <calculation>
Description
The maths command does arithmetic for you, cos maths is hard!
This command understands addition (+), subtraction (-), multiplication (*) and division (/). The normal order of operations is used, ie, multiplication and division, then addition and subtraction. Parentheses may be used to force things to be evaluated before other things. There are also a number of mathematical functions included, as follows:
sin( x ) | The sine of the angle x, in radians. | |
cos( x ) | The cosine of the angle x, in radians. | |
tan( x ) | The tangent of the angle x, in radians. | |
asin( x ) | The arcsine of a number x between -1 and 1. | |
acos( x ) | The arccosine of a number x between -1 and 1. | |
atan( x ) | The arctangent of a number x. | |
sqrt( x ) | The square root of the number x. | |
floor( x ) | The greatest integer lower than x. | |
ceil( x ) | The lowest integer greater than x. | |
round( x ) | The integer closest to x. | |
pow( x, y ) | x to the power of y. | |
exp( x ) | e to the power of x. | |
log( x ) | The natural logarithm of x. |
Example
> maths 2 + 3 * 4 + 5
19.000000
> maths (2 + 3) * (4 + 5)
45.000000
Presto wisps: Gosh it's hot outside! It was 100 today!
> alias ftoc maths ($1$ - 32) * 5/9
Added alias 'ftoc'.
> ftoc 100
37.777778
> chat I've seen hotter. :-b