You have a float variable, and you want a quick boolean expression to tell if the value has any decimals. To put it differently, to tell whether a float variable is currently holding an integer value or not.

Divide by 1, check if the remainder is 0:

1number % 1 == 0 # => true for integer, false for rational

Which makes perfect sense if you think of it. If you divide 9.5 apples among 5 children, the remainder is how many you couldn't split: 4.5. If you divide the apples among 1 children, in a strict sense there's still 0.5 you can't "split". The versions with negative operands follow from there.