Ok, I think I answer my own question but please correct me if I am wrong. The problem with the above code was that ptnum and numpt are integers and will not translate properly to the float value I included. The following however do just fine: f@grad = float (@ptnum)/ (@numpt-1);
Edited by Nicolas Heluani - Aug. 31, 2016 10:03:37
is a special case in vex wrangling that has to do with the option “Enforce Prototypes”. This forces you to declare each and every export variable to a constant value or not at all and it initializes to 0. Enforce Prototypes is all about protecting you from typos and mis-declaring exports and ending up with needless attributes on the geometry in complex wrangle code.
As you found out you can do operations on the right side if you use the simplified variable initialization form:
f@mass = float (@ptnum)/(float (@numpt) - 1);
Dividing two integers gives you an integer, never a float. Gets everyone once in a while. You have to cast one integer to a float. I usually cast both to be clear to others reading the code later on. Even further declare the known variables with their type, even though it is not necessary.