| Index: compiler/lib/implementation/number.js
|
| diff --git a/compiler/lib/implementation/number.js b/compiler/lib/implementation/number.js
|
| index b9604a7968c3dd1539661770449e7bff9ebd6fad..0a5a73cd1732a1dc9e04ac101fab9cbd11454cb5 100644
|
| --- a/compiler/lib/implementation/number.js
|
| +++ b/compiler/lib/implementation/number.js
|
| @@ -156,18 +156,39 @@ function native_NumberImplementation_toDouble() {
|
| }
|
|
|
| function native_NumberImplementation_toString() {
|
| - return this.toString();
|
| + "use strict";
|
| + var primitiveValue = +this;
|
| + // TODO(floitsch): is there a faster way to detect -0?
|
| + if (primitiveValue == 0 && (1 / primitiveValue) < 0) {
|
| + return "-0.0";
|
| + }
|
| + return "" + primitiveValue;
|
| }
|
|
|
| function native_NumberImplementation_toStringAsFixed(fractionDigits) {
|
| + var primitiveValue = +this;
|
| + // TODO(floitsch): is there a faster way to detect -0?
|
| + if (primitiveValue == 0 && (1 / primitiveValue) < 0) {
|
| + return "-" + this.toFixed(fractionDigits);
|
| + }
|
| return this.toFixed(fractionDigits);
|
| }
|
|
|
| function native_NumberImplementation_toStringAsPrecision(precision) {
|
| + var primitiveValue = +this;
|
| + // TODO(floitsch): is there a faster way to detect -0?
|
| + if (primitiveValue == 0 && (1 / primitiveValue) < 0) {
|
| + return "-" + this.toPrecision(precision);
|
| + }
|
| return this.toPrecision(precision);
|
| }
|
|
|
| function native_NumberImplementation_toStringAsExponential(fractionDigits) {
|
| + var primitiveValue = +this;
|
| + // TODO(floitsch): is there a faster way to detect -0?
|
| + if (primitiveValue == 0 && (1 / primitiveValue) < 0) {
|
| + return "-" + this.toExponential(fractionDigits);
|
| + }
|
| return this.toExponential(fractionDigits);
|
| }
|
|
|
|
|