Numeric Functions

Numeric Operators

The table below shows the available mathematical operators for numeric types.

Operator Description Example Result  
+ addition 2 + 3 5  
- subtraction 2 - 3 -1  
* multiplication 2 * 3 6  
/ division 4 / 2 2  
% modulo (remainder) 5 % 4 1  
& bitwise AND 91 & 15 11  
    bitwise OR 32 | 3 35
# bitwise XOR 17 # 5 20  
« bitwise shift left 1 « 4 16  
» bitwise shift right 8 » 2 2  

The modulo and bitwise operators work only on integral data types, whereas the others are available for all numeric data types.

Numeric Functions

The table below shows the available mathematical functions.

Function Description Example Result
abs(x) absolute value abs(-17.4) 17.4
round(v numeric, s int) round to s decimal places round(42.4332, 2) 42.43