[seed] [mpfr] Added mpfr.cmp_si_2exp



commit 97f6941a9e2aa10b431e6433c6e03dbfa23a0ff8
Author: Matt ARSENAULT <arsenm2 rpi edu>
Date:   Wed Jul 8 19:07:19 2009 -0400

    [mpfr] Added mpfr.cmp_si_2exp

 modules/mpfr/seed-mpfr-cmp.c |   40 ++++++++++++++++++++++++++++++++++++++++
 modules/mpfr/seed-mpfr.c     |    1 +
 modules/mpfr/seed-mpfr.h     |    1 +
 3 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/modules/mpfr/seed-mpfr-cmp.c b/modules/mpfr/seed-mpfr-cmp.c
index 1001df4..165594a 100644
--- a/modules/mpfr/seed-mpfr-cmp.c
+++ b/modules/mpfr/seed-mpfr-cmp.c
@@ -360,3 +360,43 @@ SeedValue seed_mpfr_unordered_p (SeedContext ctx,
     return seed_value_from_boolean(ctx, ret, exception);
 }
 
+
+SeedValue seed_mpfr_cmp_si_2exp (SeedContext ctx,
+                                 SeedObject function,
+                                 SeedObject this_object,
+                                 gsize argument_count,
+                                 const SeedValue args[],
+                                 SeedException * exception)
+{
+    mpfr_ptr op1;
+    gulong op2;
+    mp_exp_t exp;
+    gint ret;
+
+    CHECK_ARG_COUNT("mpfr.cmp_si_2exp", 2);
+
+    op1 = seed_object_get_private(this_object);
+
+    if ( seed_value_is_number(ctx, args[0]) )
+    {
+        op2 = seed_value_to_ulong(ctx, args[0], exception);
+    }
+    else
+    {
+        TYPE_EXCEPTION("mpfr.cmp_si_2exp", "long int");
+    }
+
+    if ( seed_value_is_number(ctx, args[1]) )
+    {
+        exp = seed_value_to_mp_exp_t(ctx, args[1], exception);
+    }
+    else
+    {
+        TYPE_EXCEPTION("mpfr.cmp_si_2exp", "mp_exp_t");
+    }
+
+    ret = mpfr_cmp_si_2exp(op1, op2, exp);
+
+    return seed_value_from_int(ctx, ret, exception);
+}
+
diff --git a/modules/mpfr/seed-mpfr.c b/modules/mpfr/seed-mpfr.c
index 6445cd4..13aa2cf 100644
--- a/modules/mpfr/seed-mpfr.c
+++ b/modules/mpfr/seed-mpfr.c
@@ -1069,6 +1069,7 @@ seed_static_function mpfr_funcs[] =
     {"swap", seed_mpfr_swap, 0},
     {"cmp", seed_mpfr_cmp, 0},
     {"cmpabs", seed_mpfr_cmpabs, 0},
+    {"cmp_si_2exp", seed_mpfr_cmp_si_2exp, 0},
     {"greater_p", seed_mpfr_greater_p, 0},
     {"greaterequal_p", seed_mpfr_greaterequal_p, 0},
     {"less_p", seed_mpfr_less_p, 0},
diff --git a/modules/mpfr/seed-mpfr.h b/modules/mpfr/seed-mpfr.h
index c94b2d5..4793287 100644
--- a/modules/mpfr/seed-mpfr.h
+++ b/modules/mpfr/seed-mpfr.h
@@ -130,6 +130,7 @@ DEF_SEED_MPFR_FUNC(seed_mpfr_div_2si);
 
 DEF_SEED_MPFR_FUNC(seed_mpfr_cmp);
 DEF_SEED_MPFR_FUNC(seed_mpfr_cmpabs);
+DEF_SEED_MPFR_FUNC(seed_mpfr_cmp_si_2exp);
 
 DEF_SEED_MPFR_FUNC(seed_mpfr_nan_p);
 DEF_SEED_MPFR_FUNC(seed_mpfr_inf_p);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]