| Index: runtime/lib/double.dart
|
| diff --git a/runtime/lib/double.dart b/runtime/lib/double.dart
|
| index 65dd3e779fe09554defd0d6ad7816fe5aedd4db6..c657f14f8139607c2d966db130ce40f55cdf1825 100644
|
| --- a/runtime/lib/double.dart
|
| +++ b/runtime/lib/double.dart
|
| @@ -150,11 +150,20 @@ class Double implements double {
|
| // look at the fractionDigits first.
|
|
|
| // Step 7.
|
| - if (fractionDigits < 0 || fractionDigits > 20) {
|
| + if (fractionDigits !== null &&
|
| + (fractionDigits < 0 || fractionDigits > 20)) {
|
| // TODO(antonm): should be proper RangeError or Dart counterpart.
|
| throw "Range error";
|
| }
|
|
|
| + if (isNaN()) return "NaN";
|
| + if (this == double.INFINITY) return "Infinity";
|
| + if (this == -double.INFINITY) return "-Infinity";
|
| +
|
| + // The dart function prints the shortest representation when fractionDigits
|
| + // equals null. The native function wants -1 instead.
|
| + fractionDigits = (fractionDigits === null) ? -1 : fractionDigits;
|
| +
|
| return _toStringAsExponential(fractionDigits);
|
| }
|
| String _toStringAsExponential(int fractionDigits)
|
| @@ -173,6 +182,10 @@ class Double implements double {
|
| throw "Range error";
|
| }
|
|
|
| + if (isNaN()) return "NaN";
|
| + if (this == double.INFINITY) return "Infinity";
|
| + if (this == -double.INFINITY) return "-Infinity";
|
| +
|
| return _toStringAsPrecision(precision);
|
| }
|
| String _toStringAsPrecision(int fractionDigits)
|
|
|