287 {
288 const double nan = std::numeric_limits<double>::quiet_NaN();
289 const double infinity = std::numeric_limits<double>::infinity();
290
291 auto specialEqual = [] (
double actual,
double test) {
292 if (std::isnan(actual)) {
293 return std::isnan(
test);
294 }
295
296 if (std::isinf(actual)) {
297 return std::isinf(
test);
298 }
299
300
301 const double errorFactor =
std::sqrt(std::numeric_limits<double>::epsilon());
303 };
304
305 auto p2 = [](
double a) {
307 };
308
310
311 {2, 0, 3, nan, nan},
312 {1, 1, 1, nan, nan},
313 {2.0 * p2(600), 0, 2.0 * p2(600), nan, nan},
314 {-2.0 * p2(600), 0, -2.0 * p2(600), nan, nan},
315
316
317 {0, 0, 0, infinity, infinity},
318 {0, 1, 0, 0, 0},
319 {0, 1, 2, -2, -2},
320 {0, 3, 4, -4.0/3.0, -4.0/3.0},
321 {0, p2(600), -p2(600), 1, 1},
322 {0, p2(600), p2(600), -1, -1},
323 {0, p2(-600), p2(600), -infinity, -infinity},
324 {0, p2(600), p2(-600), 0, 0},
325 {0, 2, -1.0e-323, 5.0e-324, 5.0e-324},
326 {3, 0, 0, 0, 0},
327 {p2(600), 0, 0, 0, 0},
328 {2, 0, -3, -
sqrt(3.0/2.0),
sqrt(3.0/2.0)},
329
330 {3, 2, 0, -2.0/3.0, 0},
331
332 {p2(-600), p2(700), 0, -infinity, 0},
333 {p2(600), p2(-700), 0, 0, 0},
334
335
336 {1, -1, -1, -0.6180339887498948, 1.618033988749895},
337 {1, 1 + p2(-52), 0.25 + p2(-53), (-1 - p2(-51)) / 2.0, -0.5},
338 {1, p2(-511) + p2(-563), std::exp2(-1024), -7.458340888372987e-155,-7.458340574027429e-155},
339 {1, p2(27), 0.75, -134217728.0, -5.587935447692871e-09},
340 {1, -1e9, 1, 1
e-09, 1000000000.0},
341
342 {p2(600), 0.5, -p2(-600), -3.086568504549085e-181, 1.8816085719976428e-181},
343
344
345 {1, p2(26), -0.125, -67108864.0, 1.862645149230957e-09},
346
347 {p2(600), -p2(-600), -p2(-600), -2.409919865102884e-181, 2.409919865102884e-181},
348
349
350 {-158114166017, 316227766017, -158113600000, 0.99999642020057874, 1},
351 {-312499999999.0, 707106781186.0, -400000000000.0, 1.131369396027, 1.131372303775},
352 {-67, 134, -65, 0.82722631488372798, 1.17277368511627202},
353 {0.247260273973, 0.994520547945, -0.138627953316, -4.157030027041105, 0.1348693622211607},
354 {1, -2300000, 2.0e11, 90518.994979145, 2209481.005020854},
355 {1.5*p2(-1026), 0, -p2(1022), -1.4678102981723264e308, 1.4678102981723264e308},
356
357
358 {1.5*p2(-1026), 0, -p2(1022), -1.4678102981723264e308, 1.4678102981723264e308},
359 };
360
361 for (auto testCase : cases) {
362 double A = testCase.
A,
365 answerLo = testCase.answerLo,
366 answerHi = testCase.answerHi;
369 }
375 }
376}
static bool SkIsFinite(T x, Pack... values)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
SIN Vec< N, float > abs(const Vec< N, float > &x)
SIN Vec< N, float > sqrt(const Vec< N, float > &x)