Rounding in Chance to Hit Calculations

espr

Member
I know that in the attack rating and defense calculations involving rounding down results with the percentage modifiers, but does the chance to hit calculation have any points where it's rounded down?

For reference:
Code:
Chance to Hit % = 100 x AR / (AR + DR) x 2 x Alvl / (Alvl + DLvl)

First within that calculation are any of those steps rounded down? Or rather, do we know for sure one way or the other? Along those lines, are there any issues with significant figures/truncating to be aware of? I'd like my handy dandy chance-to-hit calculator spreadsheet thing to be as accurate as possible. :)

And lastly, is the final% rounded down to the nearest whole number? IE is 88.98% Chance to hit rounded to 88%, making a single charm's difference (boosting the CTH to 89.05%) far more significant than it otherwise would be?

I expect that this would be the case since almost everything in the game rounds down, but it would be good to know for sure. If this is the case, it would lead to the same sort of "breakpoint" situation as we see with MF, that might be of value to keep in mind when comparing say... fine and steel small charms, or even 1.07 maxxers.

After all if that 15 ar on a fine charm just ends up getting rounded down in the CTH anyway, no reason to not just use the +11 maxxer instead. :)

Does anyone know?
 
Check the Statistics Forum Stickys
http://www.purediablo.com/forums/forums/theorycrafting-and-statistics.13/

http://web.archive.org/web/20070808072323/http://www.purediablo.com/guides/news.php?id=551#Chance to hit

Chance to Hit

100 * AR / (AR + DR) * 2 * alvl / (alvl + dlvl)
AR = Attack Rating; alvl = Level of Attacker; dlvl = Level of Defender; DR = Defense Rating

Note: Attacks will never have less than 5% chance to hit nor more than 95% chance to hit.

Final chance to hit is truncated. (Not Rounded)

Example

I have an AR of 10,000. I am lvl85 (attacker) and the Defender is lvl90 with a defense of 5000

= 100 * AR / (AR + DR) * 2 * alvl / (alvl + dlvl)
= 100 * 10000/ (10000 + 5000) * 2 * 85/ ( 85 + 90)
= 1000000/(10000 + 5000) * 2 * 85/(85 + 90)
= 1000000/(15000) * 2 * 85/(175)
= 1000000/(15000) * 2 * 85/(175)
= 66.667 * 2 * 85/175
= 133.333 * 85/175
= 11333.333/175
= 64.761% chance to hit.
 
Last edited:
Doh... of course I should have gone through there manually. *facepalm*

Thanks, one of the wayback links showed a slightly different version of Gustafsson's AR article that says the final chance to hit percentage will be truncated.

Given that the example calculation didn't round anything during the calculation process, I suppose that answers my question about that as well.

Thanks. :)
 
not sure how many digits are used but assuming just 2 then yes.
truncated = cut off so .6499* would = .64
as this as a % and max=.95 or 95%

The rounding thing would not matter even if used, unless asking about a specific opponent with a known Defence and lvl diff.

More is always better unless you can hit them 95% of the time.
 
It's fairly minor, but it can make a difference with a dedicated runner of a specific target. Usually just the difference between a fine small charm and a steel small charm. Sometimes the latter ends up making no difference, so one might as well use the fine (or the opposite). I realize it's being overly min-maxy though, heh.
 
AR is easy = get a few set items or fools, enchant, decript curse, Zon Skills etc.
ITD works for non-bosses
 
That or Lower resists can break immunities but not a AR calc factor correct.
You can't hit/damage immunes until that's broken though.

Meh To Quote SSog "Consider adding some Battle Cry to your routine. At a decent level, it cuts enemy damage in half and reduces their defense to 0 Plus it works on almost every monster in the game, including act bosses and ubers, at full effectiveness (although it's a moot point on the ubers, since you need yourself some lifetap)."
 
Last edited:
I'm not sure that the links explain how rounding is done is done in D2. It seems they just explain how much accuracy a human would put into it. It might be the case that it was explained in a different thread, however.
 
Unfortunately that strategy page is the only one I've seen even say anything about how the results are handled. And what 'truncated' means in this context isn't made clear. The obvious implication is that any decimals are simply dropped, and this is somewhat supported by other calculations in the game behaving the same way (such as the percentage increase to unique drops via MF), but it's still a case of assuming things.

Everywhere else doesn't address the issue, even when other calculations in the same article do, including arreat summit. That said, many other combat calculations involve truncation at multiple points, but I've never seen anything said as to how many significant figures any of these calculations keep. The only thing I remember even mentioning how many decimal places are kept is in RTB's total damage calculations which says "Rounded down to 0.01 accuracy" which I'm not even really sure if that means 2 decimal places are kept, or something else, and even then that's about stat weighting/enhanced damage.

The only places that make any determination of this that I've seen, are first, the LCS which drops any decimals, and the online to hit calculator, which floors the results of the formula. The former of which almost certainly means nothing, and the latter of which could mean anything.
 
I alway figured it to 2 places and seems accurate enough for me.

Never carry a +7 if I have a +10 though, or try to balance it. It's more of a; Does the build hit fast enough to trigger my life tap % or CB CTC Etc or not? Even if a low dam per hit ranged attack.
 
Last edited:
Back
Top