boolean
test_all(unsigned verbose, FILE *fp)
{
   boolean success = TRUE;

   test_round(verbose, fp);

   return success;
}
Beispiel #2
0
 void
 run() override
 {
     test_comparisons ();
     test_composition ();
     test_operations ();
     test_ceil_in ();
     test_ceil_out ();
     test_raw ();
     test_round ();
 }
Beispiel #3
0
int main()
{
	int Error(0);

	Error += test_modf();
	Error += test_floatBitsToInt();
	Error += test_floatBitsToUint();
	Error += test_mix();
	Error += test_round();
	Error += test_roundEven();
	Error += test_isnan();
	Error += test_isinf();

	return Error;
}
int main() {
  test_cos_det();
  test_sin_det();
  test_atan2_det();
  test_atan2();
  test_pow_det();
  test_pow_singleton_exp();
  test_pow();
  test_fmod_det();
  test_fmod();
  test_sqrt_det();
  test_sqrt();
  test_exp_det();
  test_log_det();
  test_log10_det();

  test_powf_det();
  test_powf_singleton_exp();
  test_powf();
  test_sqrtf_det();
  test_sqrtf();
  test_expf_det();
  test_logf_det();
  test_log10f_det();

  test_diff_pow_powf();

  test_floor_det();
  test_ceil_det();
  test_trunc_det();
  test_round_det();
  test_floor();
  test_ceil();
  test_trunc();
  test_round();

  test_floorf_det();
  test_ceilf_det();
  test_truncf_det();
  test_roundf_det();
  test_floorf();
  test_ceilf();
  test_truncf();
  test_roundf();

  return 0;
}
void
test_compat() {
    test_round(3.5);
    test_round(3.2);
    test_round(3.7);
    test_round(-1);
    test_round(-1.5);
    test_round(-1.7);
    test_round(-1.2);

    test_bn("/foo");
    test_bn("foo");
    test_bn("//");
    test_bn("/");
    test_bn("");
}
Beispiel #6
0
static void test_math(void) {
	test_round();
	test_roundf();
}
Beispiel #7
0
int main()
{
    test_acos();
    test_asin();
    test_atan();
    test_atan2();
    test_ceil();
    test_cos();
    test_cosh();
    test_exp();
    test_fabs();
    test_floor();
    test_fmod();
    test_frexp();
    test_ldexp();
    test_log();
    test_log10();
    test_modf();
    test_pow();
    test_sin();
    test_sinh();
    test_sqrt();
    test_tan();
    test_tanh();
    test_signbit();
    test_fpclassify();
    test_isfinite();
    test_isinf();
    test_isnan();
    test_isnormal();
    test_isgreater();
    test_isgreaterequal();
    test_isless();
    test_islessequal();
    test_islessgreater();
    test_isunordered();
    test_acosh();
    test_asinh();
    test_atanh();
    test_cbrt();
    test_copysign();
    test_erf();
    test_erfc();
    test_exp2();
    test_expm1();
    test_fdim();
    test_fma();
    test_fmax();
    test_fmin();
    test_hypot();
    test_ilogb();
    test_lgamma();
    test_llrint();
    test_llround();
    test_log1p();
    test_log2();
    test_logb();
    test_lrint();
    test_lround();
    test_nan();
    test_nearbyint();
    test_nextafter();
    test_nexttoward();
    test_remainder();
    test_remquo();
    test_rint();
    test_round();
    test_scalbln();
    test_scalbn();
    test_tgamma();
    test_trunc();
}
Beispiel #8
0
void test_all_round() {
    test_round(nan, nan, nan, "nan");
    test_round(nannan, nannan, nan, "nannan nannan");
    test_round(nannan, 0, nan, "nannan 0");
    test_round(0, nannan, nan, "0 nannan");
    test_round(zero, zip, zero, "zero zip");
    test_round(zip, zero, zero, "zip zero");
    test_round(zip, zip, zero, "zip zip");
    test_round(pi, dec64_new(-18, 0), pi, "pi -18");
    test_round(pi, dec64_new(-17, 0), pi, "pi -17");
    test_round(pi, dec64_new(-16, 0), dec64_new(31415926535897932, -16), "pi -16");
    test_round(pi, dec64_new(-15, 0), dec64_new(3141592653589793, -15), "pi -15");
    test_round(pi, dec64_new(-14, 0), dec64_new(314159265358979, -14), "pi -14");
    test_round(pi, dec64_new(-13, 0), dec64_new(31415926535898, -13), "pi -13");
    test_round(pi, dec64_new(-12, 0), dec64_new(314159265359, -11), "pi -12");
    test_round(pi, dec64_new(-11, 0), dec64_new(314159265359, -11), "pi -11");
    test_round(pi, dec64_new(-10, 0), dec64_new(31415926536, -10), "pi -10");
    test_round(pi, dec64_new(-9, 0), dec64_new(3141592654, -9), "pi -9");
    test_round(pi, dec64_new(-8, 0), dec64_new(314159265, -8), "pi -8");
    test_round(pi, dec64_new(-7, 0), dec64_new(31415927, -7), "pi -7");
    test_round(pi, dec64_new(-6, 0), dec64_new(3141593, -6), "pi -6");
    test_round(pi, dec64_new(-5, 0), dec64_new(314159, -5), "pi -5");
    test_round(pi, dec64_new(-4, 0), dec64_new(31416, -4), "pi -4");
    test_round(pi, dec64_new(-3, 0), dec64_new(3142, -3), "pi -3");
    test_round(pi, dec64_new(-2, 0), dec64_new(314, -2), "pi -2");
    test_round(pi, negative_one, dec64_new(31, -1), "pi -1");
    test_round(pi, zero, three, "pi 0");
    test_round(negative_pi, dec64_new(-18, 0), negative_pi, "-pi -18");
    test_round(negative_pi, dec64_new(-17, 0), negative_pi, "-pi -17");
    test_round(negative_pi, dec64_new(-16, 0), dec64_new(-31415926535897932, -16), "-pi -16");
    test_round(negative_pi, dec64_new(-15, 0), dec64_new(-3141592653589793, -15), "-pi -15");
    test_round(negative_pi, dec64_new(-14, 0), dec64_new(-314159265358979, -14), "-pi -14");
    test_round(negative_pi, dec64_new(-13, 0), dec64_new(-31415926535898, -13), "-pi -13");
    test_round(negative_pi, dec64_new(-12, 0), dec64_new(-314159265359, -11), "-pi -12");
    test_round(negative_pi, dec64_new(-11, 0), dec64_new(-314159265359, -11), "-pi -11");
    test_round(negative_pi, dec64_new(-10, 0), dec64_new(-31415926536, -10), "-pi -10");
    test_round(negative_pi, dec64_new(-9, 0), dec64_new(-3141592654LL, -9), "-pi -9");
    test_round(negative_pi, dec64_new(-8, 0), dec64_new(-314159265, -8), "-pi -8");
    test_round(negative_pi, dec64_new(-7, 0), dec64_new(-31415927, -7), "-pi -7");
    test_round(negative_pi, dec64_new(-6, 0), dec64_new(-3141593, -6), "-pi -6");
    test_round(negative_pi, dec64_new(-5, 0), dec64_new(-314159, -5), "-pi -5");
    test_round(negative_pi, dec64_new(-4, 0), dec64_new(-31416, -4), "-pi -4");
    test_round(negative_pi, dec64_new(-3, 0), dec64_new(-3142, -3), "-pi -3");
    test_round(negative_pi, dec64_new(-2, 0), dec64_new(-314, -2), "-pi -2");
    test_round(negative_pi, negative_one, dec64_new(-31, -1), "-pi -1");
    test_round(negative_pi, zero, dec64_new(-3, 0), "-pi 0");
    test_round(dec64_new(449, -2), dec64_new(-2, 0), dec64_new(449, -2), "4.49 -2");
    test_round(dec64_new(449, -2), negative_one, dec64_new(45, -1), "4.49 -1");
    test_round(dec64_new(449, -2), zero, four, "4.49 0");
    test_round(dec64_new(450, -2), zero, five, "4.50 0");
    test_round(dec64_new(-449, -2), dec64_new(-2, 0), dec64_new(-449, -2), "-4.49 -2");
    test_round(dec64_new(-449, -2), negative_one, dec64_new(-45, -1), "-4.49 -1");
    test_round(dec64_new(-449, -2), zero, dec64_new(-4, 0), "-4.49 0");
    test_round(dec64_new(-450, -2), zero, dec64_new(-5, 0), "-4.50 0");
    test_round(maxint, negative_one, maxint, "maxint -1");
    test_round(maxint, zero, maxint, "maxint 0");
    test_round(maxint, one, dec64_new(3602879701896397, 1), "maxint 1");
    test_round(maxint, two, dec64_new(3602879701896400, 1), "maxint 2");
    test_round(maxint, three, dec64_new(3602879701896400, 1), "maxint 3");
    test_round(maxint, four, dec64_new(36028797018960000, 0), "maxint 4");
    test_round(maxint, five, dec64_new(36028797019000000, 0), "maxint 5");
    test_round(maxint, six, dec64_new(36028797019000000, 0), "maxint 6");
    test_round(maxint, seven, dec64_new(36028797020000000, 0), "maxint 7");
    test_round(maxint, eight, dec64_new(36028797000000000, 0), "maxint 8");
    test_round(maxint, nine, dec64_new(36028797000000000, 0), "maxint 9");
    test_round(maxint, ten, dec64_new(36028800000000000, 0), "maxint 10");
    test_round(maxint, dec64_new(11, 0), dec64_new(36028800000000000, 0), "maxint 11");
    test_round(maxint, dec64_new(12, 0), dec64_new(36029000000000000, 0), "maxint 12");
    test_round(maxint, dec64_new(13, 0), dec64_new(36030000000000000, 0), "maxint 13");
    test_round(maxint, dec64_new(14, 0), dec64_new(36000000000000000, 0), "maxint 14");
    test_round(maxint, dec64_new(15, 0), dec64_new(36000000000000000, 0), "maxint 15");
    test_round(maxint, dec64_new(16, 0), dec64_new(40000000000000000, 0), "maxint 16");
    test_round(maxint, dec64_new(17, 0), zero, "maxint 17");
}