I need to store GPS coordinates in a database. I’ve heard that floats are less accurate than decimals. Is that true? If so, what reason is there to ever use floats?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want more accurate GPS coordinates, then yes decimals are the way to go. You can create them with a migration like:
The reason people use floats is that they are usually precise enough for most use cases and use less space to store.