veekun / pokedex

more than you ever wanted to know about Pokémon
MIT License
1.44k stars 637 forks source link

Why are Pokemon weight and height from the API 10x their actual value? #249

Closed arnavb closed 5 years ago

arnavb commented 5 years ago

So when I was using PokeAPI, I found that running a GET request on a Pokemon yields heights and weights for Pokemon that are 10x their original value. In order to find out the reasoning behind this, I opened an issue on PokeAPI. The response there was that "[w]e take our data from Veekun [and] [w]e do not modify" it.

So I will ask the same question here: Why are Pokemon weight and height from the API 10x their actual value?

encukou commented 5 years ago

It's an issue of units: The games store height in decimeters and weight in decagrams (good units to use if you need to store the info as whole numbers, but extremely weird for any other use, like displaying the data to people).

See: https://github.com/veekun/pokedex/blob/master/pokedex/db/tables.py#L1649

arnavb commented 5 years ago

So just to clarify, are these values are going to be kept as is?

encukou commented 5 years ago

I don't have much say here any more, but I think I can answer this :)

Yes, they will be kept as whole numbers, as the games store them. Integers are a better fit than floats (which are inexact) or decimals (which are not as readily available in most programming languages).

arnavb commented 5 years ago

Cool, thanks for the clarification!