mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
4511638: Double.toString(double) sometimes produces incorrect results
Reviewed-by: aturbanov, darcy, bpb
This commit is contained in:
parent
2f19144249
commit
72bcf2aa03
18 changed files with 4075 additions and 120 deletions
|
@ -25,8 +25,10 @@
|
|||
|
||||
package java.lang;
|
||||
|
||||
import jdk.internal.math.FloatingDecimal;
|
||||
import jdk.internal.math.DoubleToDecimal;
|
||||
import jdk.internal.math.FloatToDecimal;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Spliterator;
|
||||
import java.util.stream.IntStream;
|
||||
|
@ -875,8 +877,13 @@ abstract sealed class AbstractStringBuilder implements Appendable, CharSequence
|
|||
* @return a reference to this object.
|
||||
*/
|
||||
public AbstractStringBuilder append(float f) {
|
||||
FloatingDecimal.appendTo(f,this);
|
||||
try {
|
||||
FloatToDecimal.appendTo(f, this);
|
||||
} catch (IOException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -892,7 +899,11 @@ abstract sealed class AbstractStringBuilder implements Appendable, CharSequence
|
|||
* @return a reference to this object.
|
||||
*/
|
||||
public AbstractStringBuilder append(double d) {
|
||||
FloatingDecimal.appendTo(d,this);
|
||||
try {
|
||||
DoubleToDecimal.appendTo(d, this);
|
||||
} catch (IOException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue