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

Calogero Mauceri mauceri at actgate.com
Wed Mar 14 12:32:21 EST 2012


I've been struggling since a few days to understand a very odd behavior 
with proj.
I have 2 versions of proj libraries and utils, one compiled with 
Microsoft Visual C++ 2008 (Express Edition) and another one compiled 
with Microsoft Visual C++ 2003.

Analyzing some strange results in our processes, I found out that 
executing some transformations using the two proj libraries return two 
(very) different results.
Here is an example of a transformation that is giving me problems using 
the cs2cs utility.

cs2cs -f "%.5f" +proj=tpeqd +a=2440e3 +b=2440e3 +lat_1=-22.960070000 
+lon_1=65.546300000 +lat_2=-22.959730000 +lon_2=65.546160000 +no_defs 
+to +proj=longlat +a=2440e3 +b=2440e3 +lon_0=0 +no_defs
-2385.33232 0.00000

On the cs2cs compiled with Microsoft Visual C++ 2008 that transformation 
returns a meaningful result
65.56780        -23.01227 0.00000
while in the version compiled with Microsoft Visual C++ 2003, it returns
*       * 0.00000

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.

Now, looking (by chance) at the compilation options of the proj, I 
noticed that between the options passed to the cl compiler there is the 
consistency floating point option " /Op". As stated in the "Microsoft 
Visual Floating-Point Optimization" 
http://msdn.microsoft.com/en-us/library/aa289157(v=vs.71).aspx 
<http://msdn.microsoft.com/en-us/library/aa289157%28v=vs.71%29.aspx>

"The consistency model can seriously reduce efficiency while 
simultaneously providing no guarantee of increased accuracy. To serious 
numerical programmers, this doesn't seem like a very good tradeoff and 
is the primary reason that the model is not generally well received."

Disabling that option, the result returned in the version of proj 
compiled with Microsoft Visual C++ 2003 is more consistent.
Is there any reason why the /Op option is used to compile the proj?

Regards,
     Calogero

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20120314/764ebca4/attachment.htm 


More information about the Proj mailing list