示例#1
0
static void
special (void)
{
    mpfr_t x;
    int inex;

    mpfr_init (x);

    mpfr_set_nan (x);
    mpfr_clear_flags ();
    inex = test_log1p (x, x, MPFR_RNDN);
    MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
    MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);

    mpfr_set_inf (x, -1);
    mpfr_clear_flags ();
    inex = test_log1p (x, x, MPFR_RNDN);
    MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
    MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);

    mpfr_set_inf (x, 1);
    mpfr_clear_flags ();
    inex = test_log1p (x, x, MPFR_RNDN);
    MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) > 0 && inex == 0);
    MPFR_ASSERTN (__gmpfr_flags == 0);

    mpfr_set_ui (x, 0, MPFR_RNDN);
    mpfr_clear_flags ();
    inex = test_log1p (x, x, MPFR_RNDN);
    MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x) && inex == 0);
    MPFR_ASSERTN (__gmpfr_flags == 0);
    mpfr_neg (x, x, MPFR_RNDN);
    mpfr_clear_flags ();
    inex = test_log1p (x, x, MPFR_RNDN);
    MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_NEG (x) && inex == 0);
    MPFR_ASSERTN (__gmpfr_flags == 0);

    mpfr_set_si (x, -1, MPFR_RNDN);
    mpfr_clear_flags ();
    inex = test_log1p (x, x, MPFR_RNDN);
    MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);
    MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_DIVBY0);

    mpfr_set_si (x, -2, MPFR_RNDN);
    mpfr_clear_flags ();
    inex = test_log1p (x, x, MPFR_RNDN);
    MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);
    MPFR_ASSERTN (__gmpfr_flags == MPFR_FLAGS_NAN);

    mpfr_clear (x);
}
示例#2
0
文件: tlog1p.c 项目: mmanley/Antares
static void
special (void)
{
  mpfr_t x;
  int inex;

  mpfr_init (x);

  mpfr_set_nan (x);
  inex = test_log1p (x, x, GMP_RNDN);
  MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);

  mpfr_set_inf (x, -1);
  inex = test_log1p (x, x, GMP_RNDN);
  MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);

  mpfr_set_inf (x, 1);
  inex = test_log1p (x, x, GMP_RNDN);
  MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) > 0 && inex == 0);

  mpfr_set_ui (x, 0, GMP_RNDN);
  inex = test_log1p (x, x, GMP_RNDN);
  MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS (x) && inex == 0);
  mpfr_neg (x, x, GMP_RNDN);
  inex = test_log1p (x, x, GMP_RNDN);
  MPFR_ASSERTN (mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_NEG (x) && inex == 0);

  mpfr_set_si (x, -1, GMP_RNDN);
  inex = test_log1p (x, x, GMP_RNDN);
  MPFR_ASSERTN (mpfr_inf_p (x) && mpfr_sgn (x) < 0 && inex == 0);

  mpfr_set_si (x, -2, GMP_RNDN);
  inex = test_log1p (x, x, GMP_RNDN);
  MPFR_ASSERTN (mpfr_nan_p (x) && inex == 0);

  mpfr_clear (x);
}
示例#3
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();
}