Constants, operators and functions for formulas in openLCA

When you add a formula in openLCA (e.g. in the amount cell of Inputs/Outputs tab), the formula interpreter allows you to use these constants, operators and functions.

Constants

ConstantDescriptionValue
pithe ratio of the circumference to the diameter of a circle3.141592653589793
ebase of the natural system of logarithms2.718281828459045

Operators

PrecedenceOperatorDescriptionExample
7- (unary)negation-1 #> -1
6^exponentiation2^3 #> 8
5*multiplication2*2 #> 4
5/division2/2 #> 1
5divinteger division7 div 2 #> 3
5modmodulus7 mod 2 #> 1
4+addition1+1 #> 2
4-subtraction1-1 #> 0
3=
==
equal to1 = 1 #> true
3<>
!=
not equal to1 <> 2 #> true
3<less than2 < 2 #> false
3<=less than or equal to2 <= 2 #> true
3>greater than3 > 2 #> true
3>=greater than or equal to3 >= 4 #> false
2&
&&
logical andtrue() & false() #> false
1|
||
logical ortrue() | true() #> true

Functions

FunctionDescriptionExample
abs(x)the absolute value of xabs(-1) #> 1
acos(x)arccos(x) the inverse cosine of xacos(-1) #> 3.14159265
and(x1;x2;...xn)logical andand(1<2;2>1) #> true
asin(x)arcsin(x) the inverse sine of xasin(-1) #> -1.57079633
atan(x)arctan(x) the inverse tangent of xatan(-1) #> -0.785398163
avg(x1;…;xN)mean(x1;…;xN) the arithmetic mean of the given numbersavg(1;2;3) #> 2
ceil(x)the smallest integer not less than xceil(2.2) #> 3
cos(x)the cosine of xcos(0) #> 1
cosh(x)the hyperbolic cosine of xcosh(0) #> 1
cotan(x)cot(x) the cotangent of xcotan(pi/2) #> 0
exp(x)Euler’s number e raised to the power of xexp(2) #> 7.38905609893065
floor(x)the largest integer not greater than xfloor(2.7) #> 2
frac(x)the fractional part of xfrac(2.7) #> 0.7
if(b;x;y)iff(b;x;y) iif(b;x;y) returns x if b evaluates to true, otherwise y is returnedif(1>2;1;2) #> 2
ipower(x;y)raises x to a power of y (y is an integer)ipower(4;2) #> 16
ln(x)the natural logarithm (base e) of xln(7.38905609893065) #> 2
lg(x)log(x) the base 10 logarithm of xlg(1000) #> 3
max(x1;…;xN)the maximum of the given numbersmax(1;2;3) #> 3
min(x1;…;xN)the minimum of the given numbersmin(1;2;3) #> 1
not(b)the logical complement of bnot(false) #> true
or(x1;x2;...;xn)logical oror(1<2;2<1) #> true
power(x;y)pow(x;y) raises x to a power of ypower(4;2.2) #> 21.112126572366314
random()returns a random number between 0 and 1random() #> …
round(x)rounds x to the nearest integerround(2.5) #> 3
sin(x)the sine of xsin(2*pi) #> 0
sinh(x)the hyperbolic sine of xsinh(0) #> 0
sqr(x)the square of xsqr(2) #> 4
sqrt(x)the square root of xsqrt(4) #> 2
tan(x)the tangent of xtan(pi/4) #> 1
tanh(x)the hyperbolic tangent of xtanh(0.5) #> 0.46…
trunc(x)int(x) the integer part of xtrunc(2.7) #> 2