[Development] Changing qreal to a float

marius.storm-olsen at nokia.com marius.storm-olsen at nokia.com
Wed Feb 15 18:07:28 CET 2012


On 15/02/2012 07:45, ext Thiago Macieira wrote:
> On quarta-feira, 15 de fevereiro de 2012 12.33.18, lars.knoll at nokia.com wrote:
>> Just a small nitpick: You won't end up on the wrong side of the river. The
>> earth has a diameter of around 40000km. With 24 bits precision, you end up
>> with a jitter of just above 2m. You might get wet feet though ;-)
>
> #define __FLT_EPSILON__ 1.19209289550781250000e-7F
>
> Multiply that by 360 (degrees in a latitude) and we've got and error of 0.15".
> Multiply it by the circumference (not the diameter) at the equator of
> 40,075,017 m and we have 4.77m.
>
> That's just one coordinate. The error accumulates with successive operations.

If it makes a difference:

- MySQL's spatial extension represents coordinates in double-percision 
(8 bytes).
     http://dev.mysql.com/doc/refman/5.0/en/gis-class-geometry.html

- SQLServer used to use 27bits in their calculations, giving "less than 
10cm on a line between the equator and the North Pole (10,000km).", but 
they are now increasing that to 48bits, giving sub-millimeteric precision.
 
http://connect.microsoft.com/SQLServer/feedback/details/580254/spatial-operations-are-done-with-a-low-precision-causing-troubles-in-the-returned-data

- Who knows what Oracle does. Their documentation is confusing at best. 
Probably because they support a multitude of coordinate systems. Their 
recommendation is not to use tolerances lower than 5 cm though.
 
http://docs.oracle.com/cd/B28359_01/appdev.111/b28400/sdo_intro.htm#autoId9

:-)

-- 
.marius


More information about the Development mailing list