Formula Syntax
For use in Calculator.
Operators
- +Addition
- -Subtraction
- *Multiplication
- /Division
- **Power
- %Remainder or modulus
- &Bitwise and
- |Bitwise or
- ^Bitwise xor
- ~Bitwise not
Logical Operators
- <>Not equal
- =Equal to
- >Greater than
- <Less than
- >=Greater than or equal to
- <=Less than or equal to
- &&Logical and
- ||Logical or
Conditional statements using logical operators evaluate to 1 or 0 (true or false).
Logical &&
and ||
operators must have the
conditions on either side enclosed in (parentheses). Example: (MyMeasure =
5) || (MyMeasure = 10).
Functions
- Cos(x)The cosine of an angle of x radians.
- Sin(x)The sine of an angle of x radians.
- Tan(x)The tangent of an angle of x radians.
- Acos(x)The principal arc cosine of x, in the interval [0,
PI
] radians. The value of x is between -1 and 1. - Asin(x)The principal arc sine of x, in the interval [-
PI
/ 2, +PI
/ 2] radians. The value of x is between -1 and 1. - Atan(x)The principal arc tangent of x, in the interval [-
PI
/ 2, +PI
/ 2] radians. The value of x is between -1 and 1. - Atan2(y, x)The principal arc tangent in the interval [-
PI
, +PI
] radians between points y and x in the Cartesian plane. The sign of the elements determines the quadrant.
- Rad(x)Converts x degrees to radians.
- Deg(x)Converts x radians to degrees.
- Abs(x)Absolute value of x.
- Neg(x)Negative value of x.
- Exp(x)Returns ex.
- Log(x)Base 10 logarithm of x.
- Ln(x)Natural logarithm of x.
- Sqrt(x)Square root of x.
- Sgn(x)Returns 1 if x is positive, -1 if x is negative, or 0 if x is zero.
- Frac(x)Fractional or decimal part of x. e.g.
frac(1.234) = 0.234
. - Trunc(x)Integer part of x. e.g.
trunc(1.234) = 1
. - Floor(x)Floor of x.
- Ceil(x)Ceiling of x.
- Min(x, y)Minimum of x and y.
- Max(x, y)Maximum of x and y.
- Clamp(x, low, high)Restricts value x to low and high limits.
- Round(x, precision)Rounds x to an integer, or to a specified number of decimal places. precision is optional.
Constants
- PIMathematical constant π (~3.14159265…).
- EMathematical constant e (~2.71828182…).
Conditionals
- <condition> ? <expr. if true> : <expr. if false>This will evaluate condition as being either true or false. If it is true, the expression to the left of the colon (:) is evaluated. If it is false, the expression to the right is evaluated.
Adapted from the [Rainmeter Manual].