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

Side by Side Diff: test/unittests/base/ieee754-unittest.cc

Issue 2070813002: Revert of [builtins] Introduce proper Float64Exp operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 atan2(std::numeric_limits<double>::infinity(), 47 atan2(std::numeric_limits<double>::infinity(),
48 -std::numeric_limits<double>::infinity())); 48 -std::numeric_limits<double>::infinity()));
49 EXPECT_DOUBLE_EQ(-0.7853981633974483, 49 EXPECT_DOUBLE_EQ(-0.7853981633974483,
50 atan2(-std::numeric_limits<double>::infinity(), 50 atan2(-std::numeric_limits<double>::infinity(),
51 std::numeric_limits<double>::infinity())); 51 std::numeric_limits<double>::infinity()));
52 EXPECT_DOUBLE_EQ(-2.356194490192345, 52 EXPECT_DOUBLE_EQ(-2.356194490192345,
53 atan2(-std::numeric_limits<double>::infinity(), 53 atan2(-std::numeric_limits<double>::infinity(),
54 -std::numeric_limits<double>::infinity())); 54 -std::numeric_limits<double>::infinity()));
55 } 55 }
56 56
57 TEST(Ieee754, Exp) {
58 EXPECT_THAT(exp(std::numeric_limits<double>::quiet_NaN()), IsNaN());
59 EXPECT_THAT(exp(std::numeric_limits<double>::signaling_NaN()), IsNaN());
60 EXPECT_EQ(0.0, exp(-std::numeric_limits<double>::infinity()));
61 EXPECT_EQ(std::numeric_limits<double>::infinity(),
62 exp(std::numeric_limits<double>::infinity()));
63 EXPECT_EQ(3.307553003638408e-308, exp(-708.0));
64 EXPECT_EQ(2.2250738585072626e-308, exp(-708.39641853226408));
65 EXPECT_EQ(0.36787944117144233, exp(-1.0));
66 EXPECT_EQ(1.0, exp(-0.0));
67 EXPECT_EQ(1.0, exp(0.0));
68 EXPECT_EQ(2.7182818284590455, exp(1.0));
69 EXPECT_EQ(2.6881171418161356e+43, exp(100.0));
70 EXPECT_EQ(8.218407461554972e+307, exp(709.0));
71 EXPECT_EQ(std::numeric_limits<double>::infinity(), exp(710.0));
72 }
73
74 TEST(Ieee754, Log) { 57 TEST(Ieee754, Log) {
75 EXPECT_THAT(log(std::numeric_limits<double>::quiet_NaN()), IsNaN()); 58 EXPECT_THAT(log(std::numeric_limits<double>::quiet_NaN()), IsNaN());
76 EXPECT_THAT(log(std::numeric_limits<double>::signaling_NaN()), IsNaN()); 59 EXPECT_THAT(log(std::numeric_limits<double>::signaling_NaN()), IsNaN());
77 EXPECT_THAT(log(-std::numeric_limits<double>::infinity()), IsNaN()); 60 EXPECT_THAT(log(-std::numeric_limits<double>::infinity()), IsNaN());
78 EXPECT_THAT(log(-1.0), IsNaN()); 61 EXPECT_THAT(log(-1.0), IsNaN());
79 EXPECT_EQ(-std::numeric_limits<double>::infinity(), log(-0.0)); 62 EXPECT_EQ(-std::numeric_limits<double>::infinity(), log(-0.0));
80 EXPECT_EQ(-std::numeric_limits<double>::infinity(), log(0.0)); 63 EXPECT_EQ(-std::numeric_limits<double>::infinity(), log(0.0));
81 EXPECT_EQ(0.0, log(1.0)); 64 EXPECT_EQ(0.0, log(1.0));
82 EXPECT_EQ(std::numeric_limits<double>::infinity(), 65 EXPECT_EQ(std::numeric_limits<double>::infinity(),
83 log(std::numeric_limits<double>::infinity())); 66 log(std::numeric_limits<double>::infinity()));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 EXPECT_EQ(3.0, log10(1000.0)); 114 EXPECT_EQ(3.0, log10(1000.0));
132 EXPECT_EQ(14.0, log10(100000000000000)); // log10(10 ^ 14) 115 EXPECT_EQ(14.0, log10(100000000000000)); // log10(10 ^ 14)
133 EXPECT_EQ(3.7389561269540406, log10(5482.2158)); 116 EXPECT_EQ(3.7389561269540406, log10(5482.2158));
134 EXPECT_EQ(14.661551142893833, log10(458723662312872.125782332587)); 117 EXPECT_EQ(14.661551142893833, log10(458723662312872.125782332587));
135 EXPECT_EQ(-0.9083828622192334, log10(0.12348583358871)); 118 EXPECT_EQ(-0.9083828622192334, log10(0.12348583358871));
136 } 119 }
137 120
138 } // namespace ieee754 121 } // namespace ieee754
139 } // namespace base 122 } // namespace base
140 } // namespace v8 123 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-machops.cc ('k') | test/unittests/compiler/js-builtin-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698