Evaluate a mathematical expression.
math(EXPR <variable> "<expression>" [OUTPUT_FORMAT <format>])
Evaluates a mathematical
<expression> and sets
<variable> to the resulting value.
The mathematical expression must be given as a string (i.e. enclosed in double quotation marks). An example is
"5 * (10 + 13)". Supported operators are
(...); they have the same meaning as in C code.
Hexadecimal numbers are recognized when prefixed with
0x, as in C code.
The result is formatted according to the option
<format> is one of
OUTPUT_FORMAToption is specified.
math(EXPR value "100 * 0xA" OUTPUT_FORMAT DECIMAL) # value is set to "1000" math(EXPR value "100 * 0xA" OUTPUT_FORMAT HEXADECIMAL) # value is set to "0x3e8"
© 2000–2019 Kitware, Inc. and Contributors
Licensed under the BSD 3-clause License.