var a = 1 var b = 2 var c = a/b ceil(a/b) will return 0 ceil(c) will return 0
This return 1 in other language like javascript.
Since both a and b are integers, a/b is performed using integer division. The result is 0. The ceiling function applied to 0 is 0.
@DaveTheCoder said: Since both a and b are integers, a/b is performed using integer division. The result is 0. The ceiling function applied to 0 is 0.
Indeed, just tested with a=1.0 b=2.0 and ceil returns 1. Thanks for the enlightenment.