[9] RFR of 8069269: (spec) Defect in the System.nanoTime spec

Brian Burkhalter brian.burkhalter at oracle.com
Sat Jan 24 00:27:31 UTC 2015

On Jan 23, 2015, at 2:16 PM, Martin Buchholz <martinrb at google.com> wrote:

> I don't get it.  t0 and t1 are supposed to be symmetrical (perhaps obtained in different threads).
> Switching them around doesn't change anything.  And correctness in the face of two's complement numerical overflow is the whole point of the example!

My take on it is, for example, given the (non-overflowing) mathematical quantities

T0 = 2^63 - 42
T1 = 2^63

and the Java variables

long t0 = Long.MAX_VALUE - 41;
long t1 = t0 + 42;

then the Java logical expression (t0 - t1) < 0 is equivalent to the mathematical inequality T0 < T1 which is what would want when comparing two such values.

More information about the core-libs-dev mailing list