Thread: Math Help
View Single Post
01-27-12, 12:25 PM   #31
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Originally Posted by Seerah View Post
Bah, I missed that second f.
We still love you.



Originally Posted by Grimsin View Post
Regardless of what method i use there is an issue with the code... when you floor the math for the cost of the repair the calculations for the faction discounts become off by up to 2 copper... or at least ive seen it up to 2copper its off by one copper most of the time.
Blizz could be rounding it, in which the formula for rounding is:
Code:
x=math.floor(y+0.5);

Either that or they could be using math.ceil() which shifts the number up to the nearest integer instead of just dropping the decimal. This is actually used most in PoS (Point of Sale) programs where fractional cents in line totals are always rounded up. This is to cover the suggested price of an item while erring on the side of being over instead of short money.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 01-27-12 at 12:37 PM.
  Reply With Quote