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

Unified Diff: tests/standalone/pow_test.dart

Issue 14619027: Fix for issue 10534. Implement int.pow correctly. Note that int.pow is considerably slower than dou… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | « runtime/lib/math_patch.dart ('k') | tests/standalone/standalone.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/pow_test.dart
===================================================================
--- tests/standalone/pow_test.dart (revision 22629)
+++ tests/standalone/pow_test.dart (working copy)
@@ -85,14 +85,23 @@
void main() {
int exp = 0;
for (int val in expectedResults) {
- Expect.equals(val, pow(2, exp++));
+ Expect.equals(val, pow(2, exp));
+ Expect.equals(val.toDouble(), pow(2, exp.toDouble()));
+ exp++;
}
+
// Optimize it.
for (int i = 0; i < 8888; i++) {
pow(2, 3);
+ pow(2.0, 3.0);
}
exp = 0;
for (int val in expectedResults) {
- Expect.equals(val, pow(2, exp++));
+ Expect.equals(val, pow(2, exp));
+ Expect.equals(val.toDouble(), pow(2, exp.toDouble()));
+ exp++;
}
+ // Test Bigints.
+ Expect.equals(5559917313492231481, pow(11, 18));
+ Expect.equals(672749994932560009201, pow(11, 20));
}
« no previous file with comments | « runtime/lib/math_patch.dart ('k') | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698