Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: frog/leg/lib/js_helper.dart

Issue 9695006: Return -0.. when the input to toStringAs* is -0.0. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/language-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/lib/js_helper.dart
diff --git a/frog/leg/lib/js_helper.dart b/frog/leg/lib/js_helper.dart
index 20c3e97e13d72a9d0ea6608684d3fce3434982bb..d6b861cfe94b501b550f7d687c5e3e2c4cf69673 100644
--- a/frog/leg/lib/js_helper.dart
+++ b/frog/leg/lib/js_helper.dart
@@ -958,7 +958,9 @@ builtin$toStringAsFixed$1(receiver, fractionDigits) {
}
checkNum(fractionDigits);
- return JS('String', @'$0.toFixed($1)', receiver, fractionDigits);
+ String result = JS('String', @'$0.toFixed($1)', receiver, fractionDigits);
+ if (receiver == 0 && receiver.isNegative()) return "-$result";
+ return result;
}
builtin$toStringAsExponential$1(receiver, fractionDigits) {
@@ -968,7 +970,10 @@ builtin$toStringAsExponential$1(receiver, fractionDigits) {
}
checkNum(fractionDigits);
- return JS('String', @'$0.toExponential($1)', receiver, fractionDigits);
+ String result = JS('String', @'$0.toExponential($1)',
+ receiver, fractionDigits);
+ if (receiver == 0 && receiver.isNegative()) return "-$result";
+ return result;
}
builtin$toStringAsPrecision$1(receiver, fractionDigits) {
@@ -978,7 +983,10 @@ builtin$toStringAsPrecision$1(receiver, fractionDigits) {
}
checkNum(fractionDigits);
- return JS('String', @'$0.toPrecision($1)', receiver, fractionDigits);
+ String result = JS('String', @'$0.toPrecision($1)',
+ receiver, fractionDigits);
+ if (receiver == 0 && receiver.isNegative()) return "-$result";
+ return result;
}
builtin$toRadixString$1(receiver, radix) {
« no previous file with comments | « no previous file | tests/language/language-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698