Mathematics Expressions

Home/Mathematics Expressions

Mathematics Expressions

Expressions use a Python-like syntax and provide a lot of powerful transformation capabilities.


Always use table.field references in expressions

Common Mathematics Expressions #

Analyze ExpressionOperatorDescriptionExampleResult
++addition2 + 35
subtraction2 – 3-1
**multiplication2 * 36
//division (integer division truncates results)4 / 22
column.op(‘%’)%modulo (remainder)5 % 41
column.op(‘^’)^exponentiation2.0 ^ 3.08
column.op(‘|/’)|/square root|/ 25.05
column.op(‘||/’)||/cube root||/ 27.03
column.op(‘!’)!factorial5 !120
column.op(‘!!’)!!factorial (prefix operator)!! 5120
column.op(‘@’)@absolute value@ -5.05
column.op(‘&’)&bitwise AND91 & 1511
column.op(‘|’)|bitwise OR32 | 335
column.op(‘#’)#bitwise XOR17 # 520
column.op(‘~’)~bitwise NOT~1-2
column.op(‘<<’)<<bitwise shift left1 << 416
column.op(‘>>’)>>bitwise shift right8 >> 22

Mathematics Functions #

Analyze ExpressionReturn TypeDescriptionExampleResult 
func.abs(x)(same as input)absolute valueabs(-17.4 )17.4 
func.cbrt(dp)Big Floatcube rootcbrt(27.0 )3 
func.ceil(dp or numeric)(same as input)smallest integer not less than argumentceil(-42. 8)-42 
func.ceiling(dp or numeric)(same as input)smallest integer not less than argument (alias for ceil)ceiling(- 95.3)-95 
func.degrees(dp)Big Floatradians to degreesdegrees(0 .5)28.64788 97565412 
func.exp(dp or numeric)(same as input)exponentialexp(1.0)2.718281 82845905 
func.floor(dp or numeric)(same as input)largest integer not greater than argumentfloor(-42 .8)-43 
func.ln(dp or numeric)(same as input)natural logarithmln(2.0)0.693147 18055994 5 
func.log(dp or numeric)(same as input)base 10 logarithmlog(100.0 )2 
func.log(b numeric, x numeric)numericlogarithm to base blog(2.0, 64.0)6 
func.mod(y, x)(same as argument types)remainder of y/xmod(9,4)1 
func.pi()Big Float“π” constantpi()3.141592 65358979 
func.power(a dp, b dp)Big Floata raised to the power of bpower(9.0 , 3.0)729 
func.power(a numeric, b numeric)numerica raised to the power of bpower(9.0 , 3.0)729 
func.radians(dp)Big Floatdegrees to radiansradians(4 5.0)0.785398 16339744 8 
func.random()Big Floatrandom value in the range 0.0 <= x < 1.0random()  
func.round(dp or numeric)(same as input)round to nearest integerround(42. 4)42 
func.round(v numeric, s int)numericround to s decimal placesround(42. 4382, 2)42.44 
func.setseed(dp)integerset seed for subsequent random() calls (value between 0 and 1.0)setseed(0 .54823)11773149 59 
func.sign(dp or numeric)(same as input)sign of the argument (-1, 0, +1)sign(-8.4 )-1 
func.sqrt(dp or numeric)(same as input)square rootsqrt(2.0)1.414213 5623731 
func.trunc(dp or numeric)(same as input)truncate toward zerotrunc(42. 8)42 
func.trunc(v numeric, s int)numerictruncate to s decimal placestrunc(42. 4382, 2)42.43 
func.width_bucket( op numeric, b1 numeric, b2 numeric, count int)integerreturn the bucket to which operand would be assigned in an equidepth histogram with count buckets, in the range b1 to b2width_bu cket(5.35 , 0.024, 10.06, 5)3 
func.least(value…)(same as input)Select the smallest value from a list. NULL values in the list are ignored. The result will be NULL only if all values are NULL.   
func.greatest(value …)(same as input)Select the largest value from a list. NULL values in the list are ignored. The result will be NULL only if all values are NULL.   

Trigonometric Functions #

Analyze ExpressionDescription
func.acos(x)inverse cosine
func.asin(x)inverse sine
func.atan(x)inverse tangent
func.atan2(x,y)inverse tangent of x/y

Go to Top