I noticed a possible bug with the Evaluate Expression component in GH2.
The component shows an error when Show Full Names is enabled. As soon as I disable it, the error disappears and the component works normally.
i was able to repeat this in the latest BETA, the expression binds to the full input names when Show Full Names is on, and names with spaces don’t parse. Thanks for reporting.. RH-97753
Another possible bug with Evaluate Expression in GH2:
The following expression calculating guitar fret placement coordinates works correctly in GH1 but not in GH2:
Incorrect result in GH2
vs. correct result in GH1
GH2 Evaluate Expression Broken.ghz (1.6 MB)
Tinkering with Evaluate Expression further, I have found that the exponentiation character ‘^’ is not working in GH2.
Thanks for reporting RH-98115, it will at least get a warning to use ‘pow’
^ isn’t an exponent operator in GH2, the expression language is C# based now
and in C# ^ is bitwise XOR, which is why it errors on doubles and quietly
returns the wrong number on integers. Use pow(x, y) or a superscript like
x² instead.
so something like this.. x/pow(2, y/12.0)
Great!
Thanks Jalphy I’ll give that a try.
As Japhy said; the GH2 expressions are C# under the hood. I’ll see what I can do about fixing the integer division issue at the source (see RH-98118)
Sadly the ^ operator means something in C# already, and it’s not exponentiation. This one is harder to fix as it would involve me changing the way C# works. I’m afraid you’ll have to learn to use the pow(b, e) function instead of the ^ operator.
Thanks very much for looking into the integer division behaviour David.
Regarding exponentiation, I have no problem at all learning a new notation for GH2, and understanding that it’s C#-based is a satisfying explanation which will help me know where to start looking if I stumble upon other issues.
GH2 is so interesting and exciting to use, and I don’t think users should expect every detail of how we use GH1 to be identical in GH2
Wonderful!
Thank you!