Limnoria-doc/use/plugins/math.rst

65 lines
1.6 KiB
ReStructuredText
Raw Normal View History

2011-06-28 08:11:32 +02:00
.. _plugin-math:
The Math plugin
===============
2011-06-28 17:29:38 +02:00
Conversion
----------
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
.. _command-math-base:
math base <fromBase> [<toBase>] <number>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
Converts *<number>* from base *<fromBase>* to base *<toBase>*.
If *<toBase>* is left out, it converts to decimal.
2011-06-28 17:29:38 +02:00
.. _command-math-convert:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
math convert [<number>] <unit> to <other unit>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
Converts from *<unit>* to *<other unit>*. If number isn't given, it
defaults to 1. For unit information, see 'units' command.
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
Calculation
-----------
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
.. _command-math-rpn:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
math rpn <rpn math expression>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
Returns the value of an RPN expression.
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
.. _command-math-icalc:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
math icalc <math expression>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
This is the same as the calc command except that it allows integer
math, and can thus cause the bot to suck up CPU. Hence it requires
the 'trusted' capability to use.
2011-06-28 17:29:38 +02:00
.. _command-math-units:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
math units [<type>]
^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
With no arguments, returns a list of measurement types, which can be
passed as arguments. When called with a type as an argument, returns
the units of that type.
2011-06-28 17:29:38 +02:00
.. _command-math-calc:
2011-06-28 08:11:32 +02:00
2011-06-28 17:29:38 +02:00
math calc <math expression>
^^^^^^^^^^^^^^^^^^^^^^^^^^^
2011-06-28 08:11:32 +02:00
Returns the value of the evaluated *<math expression>*. The syntax is
Python syntax; the type of arithmetic is floating point. Floating
point arithmetic is used in order to prevent a user from being able to
crash to the bot with something like '10**10**10**10'. One consequence
is that large values such as '10**24' might not be exact.