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

Unified Diff: runtime/lib/math_patch.dart

Issue 243923002: Revert unused optimization in math.pow and implement same code in Dart as is done in the inlined ve… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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 | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/math_patch.dart
===================================================================
--- runtime/lib/math_patch.dart (revision 35183)
+++ runtime/lib/math_patch.dart (working copy)
@@ -20,14 +20,17 @@
return 1.0; // ECMA-262 15.8.2.13
}
if (base == 1.0) return 1.0;
- if (exponent == 1.0) return base;
- if (exponent == 2.0) return base * base;
- if (exponent == 3.0) return base * base * base;
-
+
if (base.isNaN || exponent.isNaN) {
return double.NAN;
}
- return _pow(base, exponent);
+ if ((base != -double.INFINITY) && (exponent == 0.5)) {
+ if (base == 0.0) {
+ return 0.0;
+ }
+ return sqrt(base);
+ }
+ return _pow(base.toDouble(), exponent.toDouble());
}
double _pow(double base, double exponent) native "Math_doublePow";
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698