OLD | NEW |
---|---|
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "src/base/ieee754.h" | 7 #include "src/base/ieee754.h" |
8 #include "src/base/macros.h" | 8 #include "src/base/macros.h" |
9 #include "testing/gmock-support.h" | 9 #include "testing/gmock-support.h" |
10 #include "testing/gtest-support.h" | 10 #include "testing/gtest-support.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 EXPECT_EQ(0.0, exp(-1000)); | 123 EXPECT_EQ(0.0, exp(-1000)); |
124 EXPECT_EQ(0.0, exp(-745.1332191019412)); | 124 EXPECT_EQ(0.0, exp(-745.1332191019412)); |
125 EXPECT_EQ(2.2250738585072626e-308, exp(-708.39641853226408)); | 125 EXPECT_EQ(2.2250738585072626e-308, exp(-708.39641853226408)); |
126 EXPECT_EQ(3.307553003638408e-308, exp(-708.0)); | 126 EXPECT_EQ(3.307553003638408e-308, exp(-708.0)); |
127 EXPECT_EQ(4.9406564584124654e-324, exp(-7.45133219101941108420e+02)); | 127 EXPECT_EQ(4.9406564584124654e-324, exp(-7.45133219101941108420e+02)); |
128 EXPECT_EQ(0.36787944117144233, exp(-1.0)); | 128 EXPECT_EQ(0.36787944117144233, exp(-1.0)); |
129 EXPECT_EQ(1.0, exp(-0.0)); | 129 EXPECT_EQ(1.0, exp(-0.0)); |
130 EXPECT_EQ(1.0, exp(0.0)); | 130 EXPECT_EQ(1.0, exp(0.0)); |
131 EXPECT_EQ(1.0, exp(2.2250738585072014e-308)); | 131 EXPECT_EQ(1.0, exp(2.2250738585072014e-308)); |
132 EXPECT_GE(exp(1.0), exp(0.9999999999999999)); | 132 EXPECT_GE(exp(1.0), exp(0.9999999999999999)); |
133 EXPECT_LE(exp(1.0), exp(1.0000000000000002)); | 133 EXPECT_LE(exp(1.0), exp(1.0000000000000002)); |
Raymond Toy
2016/06/21 16:20:12
I remember now what the tests in 132 and 133 are d
Benedikt Meurer
2016/06/22 03:55:59
Acknowledged.
| |
134 EXPECT_EQ(2.7182818284590455, exp(1.0)); | 134 EXPECT_EQ(2.718281828459045, exp(1.0)); |
Raymond Toy
2016/06/21 16:20:12
Is it possible to use the constant E here, like yo
Benedikt Meurer
2016/06/22 03:55:59
Done.
| |
135 EXPECT_EQ(7.38905609893065e0, exp(2.0)); | 135 EXPECT_EQ(7.38905609893065e0, exp(2.0)); |
136 EXPECT_EQ(1.7976931348622732e308, exp(7.09782712893383973096e+02)); | 136 EXPECT_EQ(1.7976931348622732e308, exp(7.09782712893383973096e+02)); |
137 EXPECT_EQ(2.6881171418161356e+43, exp(100.0)); | 137 EXPECT_EQ(2.6881171418161356e+43, exp(100.0)); |
138 EXPECT_EQ(8.218407461554972e+307, exp(709.0)); | 138 EXPECT_EQ(8.218407461554972e+307, exp(709.0)); |
139 EXPECT_EQ(1.7968190737295725e308, exp(709.7822265625e0)); | 139 EXPECT_EQ(1.7968190737295725e308, exp(709.7822265625e0)); |
140 EXPECT_EQ(std::numeric_limits<double>::infinity(), exp(709.7827128933841e0)); | 140 EXPECT_EQ(std::numeric_limits<double>::infinity(), exp(709.7827128933841e0)); |
141 EXPECT_EQ(std::numeric_limits<double>::infinity(), exp(710.0)); | 141 EXPECT_EQ(std::numeric_limits<double>::infinity(), exp(710.0)); |
142 EXPECT_EQ(std::numeric_limits<double>::infinity(), exp(1000.0)); | 142 EXPECT_EQ(std::numeric_limits<double>::infinity(), exp(1000.0)); |
143 EXPECT_EQ(std::numeric_limits<double>::infinity(), | 143 EXPECT_EQ(std::numeric_limits<double>::infinity(), |
144 exp(std::numeric_limits<double>::infinity())); | 144 exp(std::numeric_limits<double>::infinity())); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 EXPECT_EQ(2.910566692924059e11, tan(1048575.0 / 2.0 * kPI)); | 305 EXPECT_EQ(2.910566692924059e11, tan(1048575.0 / 2.0 * kPI)); |
306 | 306 |
307 // Test Hayne-Panek reduction. | 307 // Test Hayne-Panek reduction. |
308 EXPECT_EQ(-0.40806638884180424e0, tan(kTwo120)); | 308 EXPECT_EQ(-0.40806638884180424e0, tan(kTwo120)); |
309 EXPECT_EQ(0.40806638884180424e0, tan(-kTwo120)); | 309 EXPECT_EQ(0.40806638884180424e0, tan(-kTwo120)); |
310 } | 310 } |
311 | 311 |
312 } // namespace ieee754 | 312 } // namespace ieee754 |
313 } // namespace base | 313 } // namespace base |
314 } // namespace v8 | 314 } // namespace v8 |
OLD | NEW |