
If you do var_dump((799-639.20)*100/799); it will gives float(20) as result. If I int conversion, I get 19. Can anybody explain on what might be happening here?

If you do var_dump((799-639.20)*100/799); it will gives float(20) as result. If I int conversion, I get 19. Can anybody explain on what might be happening here?
 
    
    I cannot speak to the official semantics of PHP, but, quite likely:
(799-639.20)*100/799) yields 19.999999999999996447286321199499070644378662109375, due to use of IEEE-754 basic 64-bit binary floating-point.var_dump does not show the full value; it rounds to a limited number of digits and shows “20”. For example, it may, in effect, format the number internally using 16 significant digits, which produces “20.00000000000000”, and then remove the trailing insignificant zeros and the trailing “.”, producing “20”.(int)(799-639.20)*100/799) first produces 19.999999999999996447286321199499070644378662109375 as above and then converts it to int, which truncates, producing 19.