MCPcopy Create free account
hub / github.com/Derious/cuMPC / test_arithmetic

Function test_arithmetic

dependence/eigen-3.4.0/test/half_float.cpp:162–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162void test_arithmetic()
163{
164 VERIFY_IS_EQUAL(float(half(2) + half(2)), 4);
165 VERIFY_IS_EQUAL(float(half(2) + half(-2)), 0);
166 VERIFY_IS_APPROX(float(half(0.33333f) + half(0.66667f)), 1.0f);
167 VERIFY_IS_EQUAL(float(half(2.0f) * half(-5.5f)), -11.0f);
168 VERIFY_IS_APPROX(float(half(1.0f) / half(3.0f)), 0.33333f);
169 VERIFY_IS_EQUAL(float(-half(4096.0f)), -4096.0f);
170 VERIFY_IS_EQUAL(float(-half(-4096.0f)), 4096.0f);
171
172 half x(3);
173 half y = ++x;
174 VERIFY_IS_EQUAL(x, half(4));
175 VERIFY_IS_EQUAL(y, half(4));
176 y = --x;
177 VERIFY_IS_EQUAL(x, half(3));
178 VERIFY_IS_EQUAL(y, half(3));
179 y = x++;
180 VERIFY_IS_EQUAL(x, half(4));
181 VERIFY_IS_EQUAL(y, half(3));
182 y = x--;
183 VERIFY_IS_EQUAL(x, half(3));
184 VERIFY_IS_EQUAL(y, half(4));
185}
186
187void test_comparison()
188{

Callers 1

EIGEN_DECLARE_TESTFunction · 0.70

Calls 1

halfClass · 0.70

Tested by

no test coverage detected