http://qs321.pair.com?node_id=11123140


in reply to Re: int() function
in thread int() function

Thank you Rob

You are right. In my first example (1.15*170)+.5 the 15th decinal digit is 4 so it rounds to 195, whereas in my second example (1.15*150)+.5 the 15th decinal digit is 6 so it rounds to 173.

The 1.15 is actually 15% (selectable by user) on top of a price. So the script calculates (1+ 15/100)*price and because the final price must be rounded to the nearest integer, I added 0.50

I wanted to avoid loading Math::Round for just one calculation.