File: math.rst

package info (click to toggle)
cmake 3.13.4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 77,660 kB
  • sloc: ansic: 271,692; cpp: 195,350; yacc: 3,203; sh: 3,078; xml: 2,586; python: 1,182; lex: 1,138; asm: 370; lisp: 275; perl: 226; java: 197; f90: 175; objc: 157; cs: 124; fortran: 113; makefile: 81; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (30 lines) | stat: -rw-r--r-- 940 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
math
----

Mathematical expressions.

::

  math(EXPR <output-variable> <math-expression> [OUTPUT_FORMAT <format>])

``EXPR`` evaluates mathematical expression and returns result in the
output variable.  Example mathematical expression is ``5 * (10 + 13)``.
Supported operators are ``+``, ``-``, ``*``, ``/``, ``%``, ``|``, ``&``,
``^``, ``~``, ``<<``, ``>>``, and ``(...)``.  They have the same meaning
as they do in C code.

Numeric constants are evaluated in decimal or hexadecimal representation.

The result is formatted according to the option "OUTPUT_FORMAT" ,
where ``<format>`` is one of:
::

 HEXADECIMAL = Result in output variable will be formatted in C code
 Hexadecimal notation.
 DECIMAL = Result in output variable will be formatted in decimal notation.


For example::

  math(EXPR value "100 * 0xA" DECIMAL)  results in value is set to "1000"
  math(EXPR value "100 * 0xA" HEXADECIMAL)  results in value is set to "0x3e8"