r/shittyprogramming • • Jul 23 '18

r/badcode how do I math?

https://imgur.com/0ysm4wG
43 Upvotes

8 comments sorted by

View all comments

Show parent comment

32

u/dmitriy_shmilo Jul 23 '18

(X/5)*5 = X

Only if X is divisible by 5.

21

u/Mildan Jul 23 '18

Pretty much, it's a rounding technique to remove trailing digits, or digits altogether.

For example 18/5 *5 would equal 15 when done with integers, not 18.