I am attempting to use Entity Framework and have a contact database that has Longitude and Latitude data from Google Maps.
The guide says that this should be stored as float.
I have created my POCO entity which includes Longitude as a float and Latitude as a float.
I have just noticed that in the database, these both come up as real.
There is still a lot of work to be done before I can get any data back from Google, I am very far away from testing and I was just wondering if anyone can tell me if this is going to be a problem later on?
Nope, that should be fine. Note that you may not get the exact same value back as you received from Google Maps, as that would have been expressed in decimal-formatted text. However, this is effectively a physical quantity, and thus more appropriate as a float/double/real/(whatever binary floating point type you like) than as a decimal. (Decimals are more appropriate for man-made quantities – particularly currency.)
If you look at the documentation for
floatandrealyou’ll see thatrealis effectivelyfloat(24)– a 32-bit floating binary point type, just likefloatin C#.EDIT: As noted in comments, if you want more than the significant 7-8 digits of accuracy provided by
float, then you probably wantdoubleinstead in C#, which would meanfloat(53)in SQL Server.