RE: [OpenMap Users] Floats Vs. Doubles

From: Martin Chapman <mchapman@sanz.com>
Date: Thu Dec 04 2003 - 17:45:51 EST

Maybe my problem is casting the float then. When ever I cast a double
that has more than 6 decimal places to a float the number gets truncated
to 6 places. I've stepped through my code and seen this happen. Even
trying to create a float from a hard coded number that has more than 6
decimals it gets truncated to six. The rounding error causes my poly
geometry not to but up against each other therefore resulting in gaps in
my imagery cuts. So I don't think the float is keeping the accuracy you
say it has. At least not for me. The results are visible when you zoom
way in on the map. Any ideas?

Martin

-----Original Message-----
From: Ken Anderson [mailto:kanderson@bbn.com]
Sent: Thursday, December 04, 2003 3:40 PM
To: Don Dietrick
Cc: Martin Chapman; openmap-users@bbn.com
Subject: Re: [OpenMap Users] Floats Vs. Doubles

In JScheme, you can do
(define (epsilon x) (if (not (= (+ 1.0 x) 1.0)) (epsilon (/ x 2.0)) to
get a quick estimate of floating point epsilon:
> (epsilon 1.0F)
5.9604645E-8F
So, say we have 7 places, and at the equator, one degree is 60 nautical
miles, and one nautical mile is 6076 feed. This gives us a float
accuracy of
> (* (* 60 6076.0) 1.0e-7)
0.036455999999999995
or 0.44 inches.

Do you really have data that is more accurate than that?

k
At 05:03 PM 12/4/2003 -0500, Don Dietrick wrote:
>Hi Martin,
>
>On Dec 3, 2003, at 11:55 AM, Martin Chapman wrote:
>
>>Don,
>>
>>Why did the architects of OpenMap choose to use floats versus doubles
>>to store point data?
>
>It was a design decision made in 1996, and we chose to save memory over

>the precision of 7-10 feet, or whatever precision the float gives. It
>depends on the latitude, but I can't remember exactly what the number
>is at the equator.
>
>Most of the data sources we dealt with at that time were world-wide
>databases, and the float accuracy was good enough.
>
>>Sometimes I have a precision problem when plotting geometry on the map

>>because my source data is double value and the coordinates get
>>truncated. This is a problem when dealing with high resolution
>>satellite imagery that requires sub-meter accuracy, which is nine
>>decimal places I think. Do you know how many decimals a float can go
>>to? Is there a way to get around this problem?
>
>Doesn't the number of decimal places depend on the number you are
>trying to represent?
>
>The only way I know to get more precision is to modify the Projection
>libraries and OMGraphics to use doubles in addition to floats. Big
>job.
>
>- Don
>
>--
>[To unsubscribe to this list send an email to "majdart@bbn.com" with
>the following text in the BODY of the message "unsubscribe
>openmap-users"]

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Dec 4 17:48:33 2003

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:37 EDT