Possible bug in Grasshopper’s Expression node

Hello there,

I encountered a strange behavior in the Expression node in Grasshopper.
I’m trying to implement a simple signum function (without the use of Python to make it faster).

It throws an error although I tried to anticipate the error by using an if clause. It returns NULL instead of zero (0) when x is 0.

Can you help?
Thanks and kind regards

Sebastian

signum error.gh (6.8 KB)

Hi @Sebastian_Scharnagl,

here you have an explanation of why this is happening.

The if statement in the expression component does not fully work in the same way as in Python, it needs to calculate both the True and the False.

Hi Fernando!

I thought that it was something like that. Well… GH makes us all creative mathematicians, so I’ll find a way :slight_smile:

Thanks for the explanation.