@Test public void getAndAdd() { AtomicDouble v = new AtomicDouble(13.0); Assert.assertEquals(13.0, v.getAndAdd(42.0), 1e-12); Assert.assertEquals(55.0, v.get(), 1e-12); }
public double getAndAdd(double amount) { long v; double d; double n; long next; do { v = value.get(); d = Double.longBitsToDouble(v); n = d + amount; next = Double.doubleToLongBits(n); } while (!value.compareAndSet(v, next)); return d; }
AtomicDouble extends Number { public double getAndAdd(double amount) { long v; double d; double n; long next; do { v = value.get(); d = Double.longBitsToDouble(v); n = d + amount; next = Double.doubleToLongBits(n); } while (!value.compareAndSet(v, next)); return d; } }
AtomicDouble extends Number { public double getAndAdd(double amount) { long v; double d; double n; long next; do { v = value.get(); d = Double.longBitsToDouble(v); n = d + amount; next = Double.doubleToLongBits(n); } while (!value.compareAndSet(v, next)); return d; } AtomicDouble();  AtomicDouble(double init); }
AtomicDouble extends Number { public double getAndAdd(double amount) { long v; double d; double n; long next; do { v = value.get(); d = Double.longBitsToDouble(v); n = d + amount; next = Double.doubleToLongBits(n); } while (!value.compareAndSet(v, next)); return d; } AtomicDouble();  AtomicDouble(double init); double get(); double addAndGet(double amount); double getAndAdd(double amount); double getAndSet(double amount); boolean compareAndSet(double expect, double update); void set(double amount); @Override int intValue(); @Override long longValue(); @Override float floatValue(); @Override double doubleValue(); }
AtomicDouble extends Number { public double getAndAdd(double amount) { long v; double d; double n; long next; do { v = value.get(); d = Double.longBitsToDouble(v); n = d + amount; next = Double.doubleToLongBits(n); } while (!value.compareAndSet(v, next)); return d; } AtomicDouble();  AtomicDouble(double init); double get(); double addAndGet(double amount); double getAndAdd(double amount); double getAndSet(double amount); boolean compareAndSet(double expect, double update); void set(double amount); @Override int intValue(); @Override long longValue(); @Override float floatValue(); @Override double doubleValue();  }