I am storing many longitudes and latitudes as doubles
, I am wondering if I can get away with storing them as floats
.
To answer this question, I need to know the approximate resolution of a single precision floating point number when the stored values are longitudes / latitudes (-180 to +180).
They both use 32 bit IEEE-754 floating point numbers (single precision). This format has a 24 bit mantissa (if you count the hidden bit), so the effective resolution is between one part in 2 23 (eight million) and one part in 2 24 (16 million). This supports six or seven decimal digits of resolution.
Single-precision floating-point format is a computer number format, usually occupying 32 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point . A floating-point variable can represent a wider range of numbers than a fixed-point variable...
Floating Point Resolution. They both use 32 bit IEEE-754 floating point numbers (single precision). This format has a 24 bit mantissa (if you count the hidden bit), so the effective resolution is between one part in 2 23 (eight million) and one part in 2 24 (16 million). This supports six or seven decimal digits of resolution.
According to IEEE standard, floating-point number is represented in two ways: 1. Single Precision: Single Precision is a format proposed by IEEE for the representation of floating-point numbers. It occupies 32 bits in computer memory. 2.
The resolution you can count on with single-precision floats is about 360 / (2 ^ 23) or 4 * 10 ^ -5.
More precisely, the largest single-precision float strictly inferior to 360.
(which is representable exactly) is about 359.999969
. For the whole range -360. .. 360
, you will be able to represent differences at least as small as the difference between these two numbers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With