Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^2: int() functionby geoperl (Novice) |
on Oct 24, 2020 at 22:28 UTC ( [id://11123140]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|