In Ruby, not all numbers are created equal (pun intended).
Decimal numbers ( 0.0 , 3.0 ) follow the IEEE 754-2008 standard for floating point arithmetic:
The standard defines arithmetic formats: binary and decimal floating-point data sets consisting of finite numbers (including signed zeros and subnormal numbers), infinity, and special non-number values ( NaNs )
Integers ( 0 , 3 ) are treated as integers.
Both NaN and Infinity (as well as -Infinity ) are special cases when such floats are intended to be processed, but integers are not, therefore, an error.
source share