Re: platform dependency?
- Subject: Re: platform dependency?
- From: Ronald F Boisvert <email@example.com>
- Date: Mon, 17 Sep 2001 08:14:15 -0400
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=us-ascii
- Organization: National Institute of Standards and Technology
- References: <JFEKILDOMHFPHLIAMBEIGEBPCAAA.firstname.lastname@example.org>
- Sender: boisvert
Just to muddy the waters a little more ...
First, portability in Java is at the byte code level, not the source
code level. The best that you can expect is the a class file will
obtain the same results on all platforms.
You should be aware, however, that in Java 1.3 there has been a slight
relaxation of exact reproducibility in the floating-point model in order
to admit faster execution (up to 10x in some cases). In the new default
floating-point model the following is true:
* anonymous doubles may use 15-bit exponents
* functions in java.Math may vary within one unit in the last place
from the correctly rounded result
The first allows temporary variables (i.e., those not explicitly named
by the programmer) to remain in registers after operations on the x86
(i.e., the Pentium). These processors have a larger exponent range
(15 bits rather than 11). The exponent can be no longer than 11 bits
if a value is ever assigned to a user-defined variable. The only change
one might expect from this is to have a computation generate Infinities
on one machine (like a Sparc) and actual results on a second (like a
The second change, in effect, allows local elementary function libraries
to be used on a given platform. The results produced by these could
differ in the last bit.
Such small changes could lead to small changes in the computed eigenvalues.
It is possible for tiny changes like this to propagate through the code
to yield completely different results, but, in this case, only if the
_problem_ being posed was very ill-conditioned.
Java does have a new floating-point mode, strictfp, which enforces the
original semantics for floating-point, insuring (in principle) that the
same results will occur on all platforms. (Note that this only insures
that the answers are the same, not that they are _right_.) The programmer
declares the floating-point mode by inserting "strictfp" as a modifier
on a class (or methods). To make Jama strict (and likely slower) you
will have to add this qualifier to the source.
michael ege wrote:
> I'am using Jama on a NT System and on an Unix Server (Sun Solaris).
> The problem is:
> We do for example a rank calculation of a 250 dimensional quadratic matrix.
> Thereby we get different results, the calculation on the NT yields full rank
> and the one on the Unix machine rank 1. The bigger eigenvalues of this
> matrix nearly the same. But there are negativ eigenvalues on the Unix
> calculation against no negativ eigenvalues on the NT OS.
> Could the Jama code be platform depend?
> Michael Ege
Date Index |
Thread Index |
Problems or questions? Contact email@example.com