ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166e/extra/AtomicDoubleArray.java
(Generate patch)

Comparing jsr166/src/jsr166e/extra/AtomicDoubleArray.java (file contents):
Revision 1.1 by jsr166, Wed Aug 10 02:03:29 2011 UTC vs.
Revision 1.3 by jsr166, Thu Oct 20 17:47:36 2011 UTC

# Line 20 | Line 20 | import static java.lang.Double.longBitsT
20   * which differs from both the primitive double {@code ==} operator
21   * and from {@link Double#equals}, as if implemented by:
22   *  <pre> {@code
23 < * boolean bitEquals(double x, double y) {
23 > * static boolean bitEquals(double x, double y) {
24   *   long xBits = Double.doubleToRawLongBits(x);
25   *   long yBits = Double.doubleToRawLongBits(y);
26   *   return xBits == yBits;
# Line 162 | Line 162 | public class AtomicDoubleArray implement
162       * if the current value is <a href="#bitEquals">bitwise equal</a>
163       * to the expected value.
164       *
165 <     * <p>May <a href="package-summary.html#Spurious">fail spuriously</a>
165 >     * <p>May <a
166 >     * href="http://download.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/package-summary.html#Spurious">
167 >     * fail spuriously</a>
168       * and does not provide ordering guarantees, so is only rarely an
169       * appropriate alternative to {@code compareAndSet}.
170       *
# Line 222 | Line 224 | public class AtomicDoubleArray implement
224          if (iMax == -1)
225              return "[]";
226  
227 <        StringBuilder b = new StringBuilder();
227 >        // Double.toString(Math.PI).length() == 17
228 >        StringBuilder b = new StringBuilder((17 + 2) * (iMax + 1));
229          b.append('[');
230 <        for (int i = 0; ; i++) {
230 >        for (int i = 0;; i++) {
231              b.append(longBitsToDouble(getRaw(byteOffset(i))));
232              if (i == iMax)
233                  return b.append(']').toString();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines