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

Martin Buchholz martinrb at google.com
Sat Jan 24 02:16:27 UTC 2015


I'm agreeing with what you say here, but t0 and t1 are symmetrical, so
still cannot understand why you want to switch them in the javadoc.

On Fri, Jan 23, 2015 at 4:27 PM, Brian Burkhalter <
brian.burkhalter at oracle.com> wrote:

>
> 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