This project is co-financed by the European Regional Development Fund through the Interreg Alpine Space programme

wiki:webgis_calc_operators_functions

List of mathematical operators and functions which can be used in the AlpES WebGIS calculation tool.

Note: remember to always put a space character between operators and operands. While some operators work without extra space characters, others might not.

Mathematical Operators

OperatorDescriptionExampleValue
+addition2 + 35
-subtraction2 - 3-1
*multiplication2 * 36
/division (integer division - truncates the result) - 0 as argument not allowed5 / 22
%modulo (remainder of division) - 0 as argument not allowed5 % 21
/\exponentiation (associates left to right)2 /\ 38
I/square root - negative argument not allowed/ 255
II/cube root - negative argument not allowed/ 273
@absolute value@ -2.422.42

Mathematical Functions

FunctionDescriptionExampleResult
abs(x)absolute value, same as operator @abs(-2.42)2.42
cbrt(x)cube rootcbrt(27.0)3
ceil(x)nearest integer greater than or equal to argumentceil(-42.8)-42
degrees(x)radians to degreesdegrees(0.5)28.64…
div(y, x)integer quotient of y/xdiv(9, 4)2
exp(x)exponentialexp(1.0)2.718…
floor(x)nearest integer less than or equal to argumentfloor(-42.8)-43
ln(x)natural logarithm - 0 as argument not allowedln(2.0)0.693…
log(x)base 10 logarithm - 0 as argument not allowedlog(100.0)2
log(b, x)logarithm to base blog(2.0, 64.0)6
mod(x, y)remainder of y/xmod(9, 4)1
pi()pi constantpi()3.141…
power(x, y)x raised to the power of ypower(9, 2)729
radians(x)degrees to radiansradians(45.0)0.785…
round(x)round to nearest integerround(42.4)42
round(x, y)round to y decimal placesround(32.36, 1)32.4
sign(x)sign of the argument (-1, 0, +1)sign(-4.1)-1
sqrt(x)square root, same as operator I\ - negative argument not allowedsqrt(2.0)1.414…
trunc(x)truncate toward zerotrunc(42.8)42
trunc(x, y)truncate to y decimal placestrunc(42.43, 1)42.4

Random Functions

FunctionDescription
random()random value in the range 0.0 ⇐ x < 1.0


wiki/webgis_calc_operators_functions.txt · 2018/09/16 00:34 andi