[concurrency-interest] Atomic double arrays

Jonathan Baxter jbaxter at panscient.com
Mon Oct 31 01:36:22 EST 2005

Is there a reason util.concurrent has no AtomicDoubleArray class?

There is this throw-away line at the end of the package docs: "You can also 
hold floats using Float.floatToIntBits and Float.intBitstoFloat conversions, 
and doubles using Double.doubleToLongBits and Double.longBitsToDouble 

But that doesn't seem to help if you want to use the atomic add methods, eg 
AtomicLongArray.getAndAdd(int i, long delta), because for doubles a and b, it 
is generally not true that Double.doubleToLongBits(a) + 
Double.doubleToLongBits(b) = Double.doubleToLongBits(a + b).

Is there another way to do atomic double array ops that doesn't involve using 


Jonathan Baxter
Panscient Technologies

More information about the Concurrency-interest mailing list