Closed jamierocks closed 8 years ago
👎 doubles are future-proof, and are more common
More common, but not what Minecraft uses.
It's a simple cast, and we won't have to break plugins if minecraft ever changes (like back when it changed from int to float).
True. But if they change it there will be a version bump so people should update anyways.
@chibill We want to maximize compatibility across versions, and make it easier for plugins. Doubles do both.
:+1: doesn't floats use less memory than doubles?
@PizzaCrust yeah but nothing relevant
@PizzaCrust Fun-fact: on 64 bit machines, floats sometimes take as much memory as a double because of word alignment. if you have a float and then a pointer in memory, the float will actually be padded with 4 more bytes to ensure the pointer is word-alligned (IE: memory address is a multiple of 4 bytes). Additionally, when the memory is in a register on a 64 bit machine, they will take up the same amount of memory, since its stupid to stuff two values in a register.
So like @sgdc3 said, the overhead is negligable and in fact, in this case, its non-existent, since the double will only be there for a little bit until its cast to a float, and will take the same amount of space in a register as a float.
This is what Minecraft uses - I see no reason why the API shouldn't