There are many situations where formulas can be used in Rainmeter to arrive at a numerical result. These might be things like:
 In a Calc measure:
Formula=(2.5 + 100) * 2
 In an IFCondition option value:
IfCondition=MeasureName > (2.5 + 100) * 2
 In a numeric meter or measure option value:
W=((2.5 + 100) * 2)
 As a numeric part of an option value:
FontColor=(255 * 0.5),255,255,255
 In a Bang:
LeftMouseUpAction=[!SetOption SomeMeter W "((2.5 + 100) * 2)"]
There are a few place where formulas are not allowed. These are primarily places where the option value is assumed to be a string and only a string. In those cases, the characters used in a formula are treated as any other string character. A few examples are:
 The
Text
option of a String meter.  The
String
option of a String measure.  The
RegExp
option of a WebParser measure. IfMatch
options.TootipText
orTooltipTitle
options.
While formulas can be used in the [Variables] section of a skin, be aware that the [Variables] section itself does not resolve the formula. If you have a variable MyVar=(5 * 2)
, then the value of #MyVar# is not "10", but literally "(5 * 2)". However, if you then use the variable in an option that does allow formulas, that option itself will do the math, as in X=#MyVar#
in a meter.
Mathematical formulas must be entirely enclosed in (parentheses) to alert Rainmeter that it is a formula, unless they are being used in a Calc measure or IfCondition option, where the function is always assumed to be a formula, and the enclosing parentheses are optional.
Note: While [Measures], [SectionVariables:] and #Variables# can be used in a formula, all the components of a formula must be numeric, using only numbers, operators, functions and constants. Using .5 or .25 in a formula will cause an error. It must be 0.5 or 0.25.
Formula Syntax
Operators
+
: Addition
: Substraction*
: Multiplication/
: Division**
: Power%
: Remainder or modulus&
: Bitwise and
: Bitwise or^
: Bitwise xor~
: Bitwise not
Logical Operators
<>
: Not equal=
: Equal to>
: Greater than<
: Less than<=
: Less than or equal to>=
: Greater than or equal to&&
: Logical and
: Logical or
Note: Conditional statements using logical operators evaluate to 1 or 0 (true / false).
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.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.Abs(x)
: Absolute value of x.Exp(x)
: Returns e^{x}.Log(x)
: Base 10 logarithm of x.Ln(x)
: Natural logarithm of x.Sqrt(x)
: Square root of x.Sgn(x)
: Return 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
PI
: Mathematical constant Pi (~3.14159265...).E
: Mathematical constant e (~2.71828182...).
Conditional Operations
<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. This is equivalent to the following ifthenelse statement:
if (condition) then expr. if true else expr. if false end if

The meter would be positioned at X=0
since the condition [Measure] < 6
evaluates to true.
Conditional operators can be nested. It should be noted that there is a maximum of 30 nested operators.

The meter would be positioned at X=97
. Since the first statement of [Measure] < 1
is false, the formula begins testing the nested formulas in order until the condition becomes true . If none of the conditions are met, the final false value of 96 would be set.