( using AmiBroker 6.39.1 x64 ) Hi everyone, I am a little confused here because when I execute this code with part_001 assigned explicitly with 0.101045, part_003 is equal to 400 exactly, but when I execute the code with part_001 assigned as the result of rangeHigh - rangeLow ( which is also == 0.101045 and is not a rounded value of any kind ) and I divide part_001 by part_002, part_003 results in 400.0001. This is a problem because ceil( part_003 ) then results in 401 and not 400. This causes some problems in my program. Am I missing something here ? I recalculated it on different calculators and the result should be 400 exactly and not 400.0001 Thanks a lot for a quick solution and explanation

Ceil is going to always give you integer LARGER than number (if any fractional part is present).
You can use round() instead.
Computers use binary, not decimal, you can't look at decimal representation and make conclusions, because such assumptions fail.