[seed] [mpfr] Added mpfr.rec_sqrt



commit 333c71453eb3a68a0d56f0160c82d057cc3e6ab2
Author: Matt ARSENAULT <arsenm2 rpi edu>
Date:   Sun Jul 5 11:49:29 2009 -0400

    [mpfr] Added mpfr.rec_sqrt

 modules/mpfr/seed-mpfr-arithmetic.c |   30 ++++++++++++++++++++++++++++++
 modules/mpfr/seed-mpfr.c            |    1 +
 modules/mpfr/seed-mpfr.h            |    1 +
 3 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/modules/mpfr/seed-mpfr-arithmetic.c b/modules/mpfr/seed-mpfr-arithmetic.c
index 2eabf15..5b59902 100644
--- a/modules/mpfr/seed-mpfr-arithmetic.c
+++ b/modules/mpfr/seed-mpfr-arithmetic.c
@@ -95,3 +95,33 @@ SeedValue seed_mpfr_sqrt (SeedContext ctx,
     return seed_value_from_int(ctx, ret, exception);
 }
 
+SeedValue seed_mpfr_rec_sqrt (SeedContext ctx,
+                              SeedObject function,
+                              SeedObject this_object,
+                              gsize argument_count,
+                              const SeedValue args[],
+                              SeedException * exception)
+{
+    mpfr_rnd_t rnd;
+    mpfr_ptr rop, op;
+    gint ret;
+
+    CHECK_ARG_COUNT("mpfr.rec_sqrt", 2);
+
+    rop = seed_object_get_private(this_object);
+    rnd = seed_value_to_mpfr_rnd_t(ctx, args[1], exception);
+
+    if ( seed_value_is_object_of_class(ctx, args[0], mpfr_class) )
+    {
+        op = seed_object_get_private(args[0]);
+    }
+    else
+    {
+        TYPE_EXCEPTION("mpfr.rec_sqrt", "mpfr_t");
+    }
+
+    ret = mpfr_rec_sqrt(rop, op, rnd);
+
+    return seed_value_from_int(ctx, ret, exception);
+}
+
diff --git a/modules/mpfr/seed-mpfr.c b/modules/mpfr/seed-mpfr.c
index 58ac8d4..3fab9d2 100644
--- a/modules/mpfr/seed-mpfr.c
+++ b/modules/mpfr/seed-mpfr.c
@@ -603,6 +603,7 @@ seed_static_function mpfr_funcs[] =
 {
     {"add", seed_mpfr_add, 0},
     {"sqrt", seed_mpfr_sqrt, 0},
+    {"rec_sqrt", seed_mpfr_rec_sqrt, 0},
     {"sin", seed_mpfr_sin, 0},
     {"cos", seed_mpfr_cos, 0},
     {"tan", seed_mpfr_tan, 0},
diff --git a/modules/mpfr/seed-mpfr.h b/modules/mpfr/seed-mpfr.h
index 07796d3..80db7cb 100644
--- a/modules/mpfr/seed-mpfr.h
+++ b/modules/mpfr/seed-mpfr.h
@@ -84,6 +84,7 @@ DEF_SEED_MPFR_FUNC(seed_mpfr_acosh);
 DEF_SEED_MPFR_FUNC(seed_mpfr_atanh);
 
 DEF_SEED_MPFR_FUNC(seed_mpfr_sqrt);
+DEF_SEED_MPFR_FUNC(seed_mpfr_rec_sqrt);
 
 #endif      /* _SEED_MFPR_H_ */
 



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