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

Side by Side Diff: src/assembler.cc

Issue 6368050: Fix Math.pow(-0, 0.5) and Math.pow(-0, -0.5). These are not equal to sqrt(-0... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 return p; 831 return p;
832 } 832 }
833 833
834 834
835 double power_double_double(double x, double y) { 835 double power_double_double(double x, double y) {
836 int y_int = static_cast<int>(y); 836 int y_int = static_cast<int>(y);
837 if (y == y_int) { 837 if (y == y_int) {
838 return power_double_int(x, y_int); // Returns 1.0 for exponent 0. 838 return power_double_int(x, y_int); // Returns 1.0 for exponent 0.
839 } 839 }
840 if (!isinf(x)) { 840 if (!isinf(x)) {
841 if (y == 0.5) return sqrt(x); 841 if (y == 0.5) return sqrt(x + 0.0); // -0 must be converted to +0.
842 if (y == -0.5) return 1.0 / sqrt(x); 842 if (y == -0.5) return 1.0 / sqrt(x + 0.0);
843 } 843 }
844 if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) { 844 if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) {
845 return OS::nan_value(); 845 return OS::nan_value();
846 } 846 }
847 return pow(x, y); 847 return pow(x, y);
848 } 848 }
849 849
850 850
851 ExternalReference ExternalReference::power_double_double_function() { 851 ExternalReference ExternalReference::power_double_double_function() {
852 return ExternalReference(Redirect(FUNCTION_ADDR(power_double_double))); 852 return ExternalReference(Redirect(FUNCTION_ADDR(power_double_double)));
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 958 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
959 state_.written_position = state_.current_position; 959 state_.written_position = state_.current_position;
960 written = true; 960 written = true;
961 } 961 }
962 962
963 // Return whether something was written. 963 // Return whether something was written.
964 return written; 964 return written;
965 } 965 }
966 966
967 } } // namespace v8::internal 967 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698