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; |
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 |
|
* |
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(); |