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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 EXPECT_THAT(log10(-1.0), IsNaN()); | 160 EXPECT_THAT(log10(-1.0), IsNaN()); |
161 EXPECT_EQ(-std::numeric_limits<double>::infinity(), log10(0.0)); | 161 EXPECT_EQ(-std::numeric_limits<double>::infinity(), log10(0.0)); |
162 EXPECT_EQ(-std::numeric_limits<double>::infinity(), log10(-0.0)); | 162 EXPECT_EQ(-std::numeric_limits<double>::infinity(), log10(-0.0)); |
163 EXPECT_EQ(std::numeric_limits<double>::infinity(), | 163 EXPECT_EQ(std::numeric_limits<double>::infinity(), |
164 log10(std::numeric_limits<double>::infinity())); | 164 log10(std::numeric_limits<double>::infinity())); |
165 EXPECT_EQ(3.0, log10(1000.0)); | 165 EXPECT_EQ(3.0, log10(1000.0)); |
166 EXPECT_EQ(14.0, log10(100000000000000)); // log10(10 ^ 14) | 166 EXPECT_EQ(14.0, log10(100000000000000)); // log10(10 ^ 14) |
167 EXPECT_EQ(3.7389561269540406, log10(5482.2158)); | 167 EXPECT_EQ(3.7389561269540406, log10(5482.2158)); |
168 EXPECT_EQ(14.661551142893833, log10(458723662312872.125782332587)); | 168 EXPECT_EQ(14.661551142893833, log10(458723662312872.125782332587)); |
169 EXPECT_EQ(-0.9083828622192334, log10(0.12348583358871)); | 169 EXPECT_EQ(-0.9083828622192334, log10(0.12348583358871)); |
| 170 EXPECT_EQ(5.0, log10(100000.0)); |
170 } | 171 } |
171 | 172 |
172 TEST(Ieee754, cbrt) { | 173 TEST(Ieee754, cbrt) { |
173 EXPECT_THAT(cbrt(std::numeric_limits<double>::quiet_NaN()), IsNaN()); | 174 EXPECT_THAT(cbrt(std::numeric_limits<double>::quiet_NaN()), IsNaN()); |
174 EXPECT_THAT(cbrt(std::numeric_limits<double>::signaling_NaN()), IsNaN()); | 175 EXPECT_THAT(cbrt(std::numeric_limits<double>::signaling_NaN()), IsNaN()); |
175 EXPECT_EQ(std::numeric_limits<double>::infinity(), | 176 EXPECT_EQ(std::numeric_limits<double>::infinity(), |
176 cbrt(std::numeric_limits<double>::infinity())); | 177 cbrt(std::numeric_limits<double>::infinity())); |
177 EXPECT_EQ(-std::numeric_limits<double>::infinity(), | 178 EXPECT_EQ(-std::numeric_limits<double>::infinity(), |
178 cbrt(-std::numeric_limits<double>::infinity())); | 179 cbrt(-std::numeric_limits<double>::infinity())); |
179 EXPECT_EQ(1.4422495703074083, cbrt(3)); | 180 EXPECT_EQ(1.4422495703074083, cbrt(3)); |
180 EXPECT_EQ(100, cbrt(100 * 100 * 100)); | 181 EXPECT_EQ(100, cbrt(100 * 100 * 100)); |
181 EXPECT_EQ(46.415888336127786, cbrt(100000)); | 182 EXPECT_EQ(46.415888336127786, cbrt(100000)); |
182 } | 183 } |
183 | 184 |
184 } // namespace ieee754 | 185 } // namespace ieee754 |
185 } // namespace base | 186 } // namespace base |
186 } // namespace v8 | 187 } // namespace v8 |
OLD | NEW |