How to check if a number is integer

It might also be useful to note that e.g. the Python float class has the is_integer() method. And that a general method across languages is to use the modulus operator:


210318_ModulusIntegerTest_Python.gh (6.1 KB)

Edit: Although it will never be faster than C#, here’s a more performant implementation:


210318_ModulusIntegerTest_Python_01.gh (6.2 KB)

3 Likes