[Proj] Problems with /Op option used to compile proj in Microsoft Visual Studio

Glynn Clements glynn at gclements.plus.com
Thu Mar 15 06:53:53 PDT 2012


Calogero Mauceri wrote:

> The same result happens with other (few) sets of coordinates.
> Looking at the error returned in the latter case, the pj_transform exits 
> with error
> -19: acos/asin: |arg| >1.+1e-14
> 
> The error happens in the aacos function: in the first case 
> 0.999999999999996 is passed to the function while in the other case the 
> number passed to the aacos is 1.000000000000012.

Calculating the arcsine or arccosine of a value very close to 1 is
bound to be numerically unstable.

Discussion of compiler optimisations is something of a red herring
here. If the calculation is relying upon the 80-bit extended
floating-point support in the x87 FPU, it won't work on architectures
which "only" use 64 bits. Similarly, just about any change to the way
that the compiler generates code may produce a different result, as
may changes to the FPU state or the system's math library.

Ultimately, I suspect that the calculation for the two-point
equidistant projection just wasn't designed for the case where the two
points are around one arc-second apart (approx. 15 metres; would be
approx. 40 metres on Earth).

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the Proj mailing list