AtomicDouble extends Number { public double getAndSet(double amount) { long v = value.getAndSet(Double.doubleToLongBits(amount)); return Double.longBitsToDouble(v); } 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();  }
@Test public void getAndSet() { AtomicDouble v = new AtomicDouble(13.0); Assert.assertEquals(13.0, v.getAndSet(42.0), 1e-12); Assert.assertEquals(42.0, v.get(), 1e-12); }