a more precise distance algorithm
ravas
ravas at outlook.com
Tue May 26 01:49:51 EDT 2015
On Monday, May 25, 2015 at 10:16:02 PM UTC-7, Gary Herron wrote:
> It's probably not the square root that's causing the inaccuracies. In
> many other cases, and probably here also, it's the summing of two
> numbers that have vastly different values that loses precision. A
> demonstration:
>
> >>> big = 100000000.0
> >>> small = 0.000000001
> >>> (big+small)-big # Should produce a value =small, but gives an exact
> zero instead.
> 0.0
>
> The squaring of the two values in x*x+y*y just makes the addition even
> more error prone since the squares make large values even larger and
> small values even smaller.
I appreciate your help.
More information about the Python-list
mailing list