3 ms·
If your goal is just to store the coordinates in a database, sure, use fixed point or whatever. But any kind of calculation will involve a great deal of trigon
by pezezin 7mo ago
If your goal is just to store the coordinates in a database, sure, use fixed point or whatever.
But any kind of calculation will involve a great deal of trigonometry, square roots, and the like. It is just easier to use floating point. Examples:
https://en.wikipedia.org/wiki/Geographic_coordinate_conversion https://en.wikipedia.org/wiki/Geographic_coordinate_conversi...
https://en.wikipedia.org/wiki/Vincenty%27s_formulae https://en.wikipedia.org/wiki/Vincenty%27s_formulae
https://gist.github.com/govert/1b373696c9a27ff4c72a https://gist.github.com/govert/1b373696c9a27ff4c72a
- taeric 7mo agoYou should be able to do the calculations in fixed point, easily enough? Indeed, it used to be that most embedded systems would use fixed point due to lack of float hardware. I would actually think fixed point would be beneficial for its accuracy being a bit more controlled than floating point is. Yes, you lose the range of floating point. But I just don't see how that is relevant for numbers that are constrained to +/- 180 by definition. That all said, I cannot and do not argue against that it is faster to get going with basic float/doubles, due to how commonly those are supported in base libraries.