Sorry for the late answer; I have been away the last four days.
Rueben Schulz a écrit :
P.S. Geotools implements the proj4 transverse mercator code, so I do not
know where the 0.05 m differences are coming from. Perhaps we use
slightly different values for semi-major and minor axises for wgs84?
This is a possibility. But the difference may also be caused by compiler
optimization. I'm pretty sure that there is differences between Proj.4
and... Proj.4 just by providing different compiler options. This is
because C/C++ compiler may optimize floating point computation by the
use of some identity like:
(a+b)+c == a+(b+c)
a*(b+c) == a*b + b*c
a / b == a * (1/b)
Unfortunatly, in the wonderful world of floating point computation,
arithmetic rules like the ones above are not exactly true. For example
a/10 == a*0.1 in mathematic, but not for a computer using IEEE 754
arithmetic. This is because the computation are performed in base 2, and
10 has an exact representation is base 2 while 0.1 can't be represented
exactly in base 2. A C/C++ compiler may replaces a/10 by a*0.1 because
the multiplication is slightly faster than division on some processors,
but the result is not strictly identical. Same applies to others
arithmetic rules cited above, and more. A developper can selects the
optimizations that a C/C++ compiler is allowed to use; this is why
compiling the same C/C++ program (Proj.4) with different compiler
options may produces slightly different results. The difference is often
small for linear operations, but may grown exponentially for non-linear
ones. In some case, the results may be completly wrong because of a
compiler optimization.
The Java performs very few floating point optimizations under the hood.
This is a philosophical choice, not a limitation of the Java language.
When you see a/b in the Java language, you are sure that the computer
computed exactly that. In C/C++, you never know for sure (unless
relevant optimizations were disabled). When I was used to program in C++
(before my switch to Java), at some point I have spent 3 full days
looking very hard for a bug in my numerical program, only to discover 3
days later that my bug disaspear if I disable some C/C++ optimizations.
It is very likely that the Java philosophical choice actually saved a
lot of time to many developpers.
Back of differences between Geotools and Proj.4: a 100 meters difference
was the expected order of magnitude for a missing datum shift. A 0.05
meters difference may be explain by the difference in the numerical
codes emitted by a C/C++ compiler with optimisations enabled, and a Java
compiler. Again, this is just an hypothesis (a slight difference in axis
lengths is an other very plausible explanation).
Martin.
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users