
It is currently Sun Jun 13, 2021 11:48 pm


Page 1 of 1

[ 5 posts ] 

Author 
Message 
Blakcat
Bug Catcher
Joined: Mon Sep 01, 2014 5:14 pm Posts: 3

Was recently using the Stat Calculator on the main site to test my new IV Calculator, and I think I came across a bug. I was testing with Mew because of its easy base stats, and it worked well up until I tried adding natures into the calculation. My IV Calculator said the stats produced were impossible.
I doublechecked the stat using Serebii's formula (serebii_net/games/stats.shtml), and it seemed to verify that the Stat Calculator's output was wrong. I tried to look for a page on Psypokes that referenced a stat calculation formula, but didn't find one. I checked the Psydex, and the base stats for Mew are correct (so I don't think it's the database). I plugged the Stat Calculator's output into Psypokes' IV Calculator and it said the stats entered were within the range of acceptable values. I guess the IV Calc and Stat Calc are using the same formula. I just don't know which formula is correct: serebii's or psypokes'.
Note that I was testing with low levels, e.g. 5 or 6. As soon as I tried levels around 910, the problems ceased.
For reference, here are the exact values I used and some expected outputs: L5 Mew @adamant w/30, 31, 19, 21, 10, 28 IVs for HP, Atk, Def, SAtk, SDef, Spd, respectively. Formula: (((IV + 2 * BaseStat + (EV/4) ) * Level/100 ) + 5) * Nature Value Since Adamant raises Atk, I'll do the calculation for Atk: (((31 + 2 * 100 + 0) * 5/100 ) + 5) * 1.1 = 18.205 > 18; the Stat Calculator says 17.
If my formula is incorrect, could someone post or link to a correct formula?

Mon Sep 01, 2014 6:46 pm 


TonberryKing
Psypoke Legend
Joined: Wed Aug 04, 2004 3:28 am Posts: 645

You round down after dividing by 100: ( ( (31 + 2 * 100 + 0) * 5 / 100 ) + 5) * 1.1 = ( ( 1155 / 100 ) + 5) * 1.1 = (11 + 5) * 1.1 = 17.6, which rounds down to 17 For all calculations like this, whenever you divide, you always round down as this is integer division. Bulbapedia has a full breakdown of the calculation here: http://bulbapedia.bulbagarden.net/wiki/ ... III_onward

Mon Sep 01, 2014 8:11 pm 


Blakcat
Bug Catcher
Joined: Mon Sep 01, 2014 5:14 pm Posts: 3

Thank you. Very helpful. I don't understand why that wasn't/isn't mentioned in the summary of the formula anywhere...
What, specifically, do you mean by "for all calculations like this"? (e.g. do you mean every Pokemon formula?) It is never explicitly stated that it's integer division, despite the fact that the end result is an integer.
Thanks again.
Edit: I just plugged the example Pokemon Bulbapedia uses, L78 Garchomp @Adamant into the stat calculator here and got different results than those Bulbapedia presents (the author didn't do integer division, though). It seems ridiculous that someone would give an example like that, do it "wrong", then claim his results might be off because he did it wrong (nor mention how to actually do it correctly).

Tue Sep 02, 2014 11:55 am 


TonberryKing
Psypoke Legend
Joined: Wed Aug 04, 2004 3:28 am Posts: 645

Quote: What, specifically, do you mean by "for all calculations like this"? (e.g. do you mean every Pokemon formula?) I'm pretty sure it's applicable to all Pokemon formulas. I know there are a few big websites who have the same implementation as us, including PokeGen: http://projectpokemon.org/forums/showth ... nformationI just tried Mew (with your sample values) and Garchomp (with Bulbapedia's sample values) and both PokeGen and our Stats Calculator agree, so I'm certain we have the correct implementation.

Tue Sep 02, 2014 5:05 pm 


Blakcat
Bug Catcher
Joined: Mon Sep 01, 2014 5:14 pm Posts: 3

Ok. Cool. I'm just a little frustrated as to why a detail such as Integer Division wasn't noted, on either Serebii or Bulbapedia, since that's kinda important.
It should also be noted (and definitely correct me if I'm wrong) that Int Division should be used for the EVs/4 as well.

Thu Sep 04, 2014 5:12 pm 




Page 1 of 1

[ 5 posts ] 

Who is online 
Users browsing this forum: No registered users and 3 guests 

You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum

