Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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_conversi...

https://en.wikipedia.org/wiki/Vincenty%27s_formulae

https://gist.github.com/govert/1b373696c9a27ff4c72a

 help



You 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: