» Expr (Value)
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

Expr (Value)

Help Parses a mathematical expression in the string and returns the value
Author vvvv group

Here you are supposed to see an image (rendered with SVG) describing the pins of this node. However, this does not work with Internet Explorer. You may want to consider using another browser, like FireFox, Chrome, Safari or Opera that do support SVG.

Credits Project JEDI Code Library (JCL)
Warnings
Bugs

related discussions

start a forum thread about this node

about Expr (Value)

Syntax

The required format of the expression is Pascal style.

List of supported operations

Comparison > < = <= >=
Logical and or xor not
Math +, -, *, /, ^, div, mod
Brackets ( )
Factorial !
Percentage %
assign to variables :=

-

List of supported functions

-
Random
-
exp(x)
-
if(x, y, z)
-
random
-
randg(Mean, StdDev)
-
sqr(x)
-
sqrt(x)
-
abs(x)
-
round(x)
-
trunc(x)
-
ln(x)
-
log10(x)
-
logN(x, y)
-
power(x, y)
-
pow(x, y)
-
intpower(x, y)
-
max(x, y)
-
min(x, y)
-
sin(x)
-
cos(x)
-
tan(x)
-
arcsin(x)
-
arccos(x)
-
arctan2(x, y)
-
sinh(x)
-
cosh(x)
-
tanh(x)
-
arcsinh(x)
-
arccosh(x)
-
arctanh(x)
-
degtorad(x)
-
radtodeg(x)
-

additional operands

factorial x!
power
x^y
percentage
x%
hexadecimal
$x (for example $FF is converted to 255)

Implicit multiplying is not supported: e.g. (X+1)(24-3) generates a syntax error and should be written (x+1)*(24-3)

Precedence

The precedence of the operands is as follows.

1 highest ! -x +x %
2
^
3
* / div mod
4
+ -
5
> >= < <= =
6
not
7
or and xor
8 lowest
:=

You can use user-defined variables in the expressions and also assign to variables using the := operand

Optimization

The compiler removes constant expressions and replaces these with the evaluated result:

4*4*x becomes 16*x
ln(5)+3*x becomes 1.609437912+3*x
limitation
4*x+3+3+5 evaluates as 4*x+3+3+5 (due to precedence rules)
whereas
4*x+(3+3+5) becomes 4*x+11

Tip: Use brackets to be sure that constant expressions are removed by the compiler

this text is mostly lifted from the readme of the Freeware component by Egbert van Nes

FAQ

Is it possible to access specific slices in the expr node? like formula which involves another slice in the spread - e.g. for some vectorstuff without splitting the spread.

sorry this is currently not possible. you would need to decompose the formula into separate nodes. or write a little c# plugin.

External Links

Developer: Egbert van Nes

anonymous user login

Shoutbox

~11h ago

joreg: vvvvTv S02E01 is out: Buttons & Sliders with Dear ImGui: https://www.youtube.com/live/PuuTilbqd9w

~7d ago

joreg: vvvvTv S02E00 is out: Sensors & Servos with Arduino: https://visualprogramming.net/blog/2024/vvvvtv-is-back-with-season-2/

~8d ago

fleg: hey there! What's the best tool for remote work? Teamviewer feels terrible. Thanks!

~21d ago

joreg: Last call: 6-session vvvv beginner course starting November 4: https://thenodeinstitute.org/courses/ws24-5-vvvv-beginners-part-i/

~1mth ago

joreg: Missed the last meetup? You can rewatch it here: https://www.youtube.com/live/MdvTa58uxB0?si=Fwi-9hHoCmo794Ag

~1mth ago

theurbankind: When is the next big event, like node festival ?

~1mth ago

~1mth ago

joreg: Join us for the next vvvv meetup on Oktober 17th: https://visualprogramming.net/blog/2024/25.-vvvv-worldwide-meetup/

~1mth ago

joreg: 6 session beginner course part 2 "Deep Dive" starts January 13th: https://thenodeinstitute.org/courses/ws24-5-vvvv-beginners-part-ii/