Home | History | Annotate | Download | only in numerics

Lines Matching refs:SrcLimits

50   typedef numeric_limits<Src> SrcLimits;
51 static_assert(SrcLimits::is_specialized, "Source must be numeric.");
55 if (SrcLimits::digits <= DstLimits::digits &&
57 return SrcLimits::max();
58 Src max = SrcLimits::max() / 2 + (SrcLimits::is_integer ? 1 : 0);
339 typedef numeric_limits<Src> SrcLimits;
342 static_assert((DstLimits::is_iec559 && SrcLimits::is_integer) ||
344 (!(DstLimits::is_integer && SrcLimits::is_iec559) &&
346 ((SrcLimits::is_signed == DstLimits::is_signed &&
352 const CheckedNumeric<Dst> checked_dst = SrcLimits::max();
357 TEST_EXPECTED_VALIDITY(RANGE_VALID, SrcLimits::max() * checked_dst);
360 TEST_EXPECTED_VALIDITY(RANGE_OVERFLOW, SrcLimits::max() * checked_dst);
367 TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::max());
369 if (SrcLimits::is_iec559) {
370 TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::max() * static_cast<Src>(-1));
371 TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::infinity());
372 TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::infinity() * -1);
373 TEST_EXPECTED_RANGE(RANGE_INVALID, SrcLimits::quiet_NaN());
376 TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::min());
384 typedef numeric_limits<Src> SrcLimits;
386 static_assert(SrcLimits::is_signed == DstLimits::is_signed,
389 (DstLimits::is_integer && SrcLimits::is_iec559),
393 SrcLimits::max());
395 TEST_EXPECTED_VALIDITY(RANGE_UNDERFLOW, checked_dst - SrcLimits::max());
397 TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::max());
399 if (SrcLimits::is_iec559) {
400 TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::max() * -1);
402 TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::infinity());
403 TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::infinity() * -1);
404 TEST_EXPECTED_RANGE(RANGE_INVALID, SrcLimits::quiet_NaN());
406 if (SrcLimits::digits < DstLimits::digits) {
417 } else if (SrcLimits::is_signed) {
419 TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::min());
423 TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::min());
431 typedef numeric_limits<Src> SrcLimits;
435 static_assert(SrcLimits::is_signed, "Source must be signed");
439 TEST_EXPECTED_VALUE(SrcLimits::max(), checked_dst + SrcLimits::max());
441 TEST_EXPECTED_VALIDITY(RANGE_UNDERFLOW, checked_dst + -SrcLimits::max());
443 TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::min());
444 TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::max());
453 typedef numeric_limits<Src> SrcLimits;
455 static_assert((DstLimits::is_integer && SrcLimits::is_iec559) ||
458 static_assert(SrcLimits::is_signed, "Source must be signed.");
463 TEST_EXPECTED_VALIDITY(RANGE_OVERFLOW, checked_dst + SrcLimits::max());
465 TEST_EXPECTED_VALIDITY(RANGE_UNDERFLOW, checked_dst + -SrcLimits::max());
467 TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::max());
470 if (SrcLimits::is_iec559) {
471 TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::max() * -1);
472 TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::infinity());
473 TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::infinity() * -1);
474 TEST_EXPECTED_RANGE(RANGE_INVALID, SrcLimits::quiet_NaN());
476 if (SrcLimits::digits < DstLimits::digits) {
488 TEST_EXPECTED_RANGE(RANGE_UNDERFLOW, SrcLimits::min());
496 typedef numeric_limits<Src> SrcLimits;
500 static_assert(!SrcLimits::is_signed, "Source must be unsigned.");
505 TEST_EXPECTED_VALIDITY(RANGE_OVERFLOW, checked_dst + SrcLimits::max());
506 TEST_EXPECTED_VALUE(SrcLimits::min(), checked_dst + SrcLimits::min());
508 TEST_EXPECTED_RANGE(RANGE_VALID, SrcLimits::min());
509 TEST_EXPECTED_RANGE(RANGE_OVERFLOW, SrcLimits::max());