Howdy
How do I check if a result of a division is a whole number?
For example: 2 / 1 = 1 (A whole number).
Or another example: 1 / 2 = 0,5 (Not a whole number).
The first thing I tried was is_float and is_integer, but as you can see below the result is always a float.
iex(1)> a = 2
2
iex(2)> b = 1
1
iex(3)> c = a / b
2.0
iex(4)> d = b / a
0.5
This wonโt work either:
iex(5)> e = div(a,b)
2
iex(6)> f = div(b,a)
0
Is there any other way?