| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <cmath> | 6 #include <cmath> |
| 7 #include <cstdarg> | 7 #include <cstdarg> |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_ARM64 | 9 #if V8_TARGET_ARCH_ARM64 |
| 10 | 10 |
| (...skipping 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2752 } | 2752 } |
| 2753 case FPTieEven: { | 2753 case FPTieEven: { |
| 2754 // Take care of correctly handling the range [-0.5, -0.0], which must | 2754 // Take care of correctly handling the range [-0.5, -0.0], which must |
| 2755 // yield -0.0. | 2755 // yield -0.0. |
| 2756 if ((-0.5 <= value) && (value < 0.0)) { | 2756 if ((-0.5 <= value) && (value < 0.0)) { |
| 2757 int_result = -0.0; | 2757 int_result = -0.0; |
| 2758 | 2758 |
| 2759 // If the error is greater than 0.5, or is equal to 0.5 and the integer | 2759 // If the error is greater than 0.5, or is equal to 0.5 and the integer |
| 2760 // result is odd, round up. | 2760 // result is odd, round up. |
| 2761 } else if ((error > 0.5) || | 2761 } else if ((error > 0.5) || |
| 2762 ((error == 0.5) && (fmod(int_result, 2) != 0))) { | 2762 ((error == 0.5) && (modulo(int_result, 2) != 0))) { |
| 2763 int_result++; | 2763 int_result++; |
| 2764 } | 2764 } |
| 2765 break; | 2765 break; |
| 2766 } | 2766 } |
| 2767 case FPZero: { | 2767 case FPZero: { |
| 2768 // If value > 0 then we take floor(value) | 2768 // If value > 0 then we take floor(value) |
| 2769 // otherwise, ceil(value) | 2769 // otherwise, ceil(value) |
| 2770 if (value < 0) { | 2770 if (value < 0) { |
| 2771 int_result = ceil(value); | 2771 int_result = ceil(value); |
| 2772 } | 2772 } |
| (...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3837 delete[] format; | 3837 delete[] format; |
| 3838 } | 3838 } |
| 3839 | 3839 |
| 3840 | 3840 |
| 3841 #endif // USE_SIMULATOR | 3841 #endif // USE_SIMULATOR |
| 3842 | 3842 |
| 3843 } // namespace internal | 3843 } // namespace internal |
| 3844 } // namespace v8 | 3844 } // namespace v8 |
| 3845 | 3845 |
| 3846 #endif // V8_TARGET_ARCH_ARM64 | 3846 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |