Commands for:
|
The functions of the CALC command are not dissimilar to those
of a professional scientific calculator, with a focus on more commonly
observed mathematic principles.
Intent The calc command is used to evaulate any valid expression given to
the bot and will return the result to the channel in which the command
was used. If the command was used via msg, the bot will then return the
result to the user via notice.
Usage The command may be issued in one of two ways.
botnick calc expression
Arguments A valid expression may include
Unary minus, unary plus, bit-wise NOT, logical NOT. None of these operands may be applied to string operands, and bit-wise NOT may be applied only to integers.
Multiply, divide, remainder. None of these operands may be applied to string operands, and remainder may be applied only to integers. The remainder will always have the same sign as the divisor and an absolute value smaller than the divisor.
Add and subtract. Valid for any numeric operands.
Left and right shift. Valid for integer operands only. A right shift always propagates the sign bit.
Boolean less, greater, less than or equal, and greater than or equal. Each operator produces 1 if the condition is true, 0 otherwise. These operators may be applied to strings as well as numeric operands, in which case string comparison is used.
Boolean equal and not equal. Each operator produces a zero/one result. Valid for all operand types.
Bit-wise AND. Valid for integer operands only.
Bit-wise exclusive OR. Valid for integer operands only.
Bit-wise OR. Valid for integer operands only.
Logical AND. Produces a 1 result if both operands are non-zero, 0 otherwise. Valid for boolean and numeric (integers or floating-point) operands only.
Logical OR. Produces a 0 result if both operands are zero, 1 otherwise. Valid for boolean and numeric (integers or floating-point) operands only.
If-then-else. If x evaluates to non-zero, then the result is the value of y. Otherwise the result is the value of z. The x operand must have a numeric value.
Returns the absolute value of arg. Arg may be either integer or floating-point, and the result is returned in the same form.
Returns the arc cosine of arg, in the range [0,pi] radians. Arg should be in the range [-1,1].
Returns the arc sine of arg, in the range [-pi/2,pi/2] radians. Arg should be in the range [-1,1].
Returns the arc tangent of arg, in the range [-pi/2,pi/2] radians.
Returns the arc tangent of y/x, in the range [-pi,pi] radians. x and y cannot both be 0.
Returns the smallest integer value not less than arg.
Returns the cosine of arg, measured in radians.
Returns the hyperbolic cosine of arg.
If arg is a floating value, returns arg, otherwise converts arg to floating and returns the converted value.
Returns the exponential of arg, defined as e**arg.
Returns the largest integral value not greater than arg.
Returns the floating-point remainder of the division of x by y. If y is 0, an error is returned.
Computes the length of the hypotenuse of a right-angled triangle (x*x+y*y).
If arg is an integer value, returns arg, otherwise converts arg to integer by truncation and returns the converted value.
Returns the natural logarithm of arg. Arg must be a positive value.
Returns the base 10 logarithm of arg. Arg must be a positive value.
Computes the value of x raised to the power y. If x is negative, y must be an integer value.
Returns a floating point number from zero to just less than one or, in mathematical terms, the range [0,1].
If arg is an integer value, returns arg, otherwise converts arg to integer by rounding and returns the converted value.
Returns the sine of arg, measured in radians.
Returns the hyperbolic sine of arg.
Returns the square root of arg. Arg must be non-negative.
Returns the tangent of arg, measured in radians.
Returns the hyperbolic tangent of arg.
botnick calc sqrt(pow(6,2) + pow(8,2)) Infact, we can save ourselves some typing by using botnick calc hypot(6,8) |
|