[seed] [mpfr] Added other mpfr constants



commit 7f2b9694fbbe839824ad07f509f714928b4b792f
Author: Matt ARSENAULT <arsenm2 rpi edu>
Date:   Sat Jul 4 02:29:23 2009 -0400

    [mpfr] Added other mpfr constants

 modules/mpfr/mpfr.c |   52 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/modules/mpfr/mpfr.c b/modules/mpfr/mpfr.c
index b6ae40c..79e62ba 100644
--- a/modules/mpfr/mpfr.c
+++ b/modules/mpfr/mpfr.c
@@ -157,6 +157,56 @@ seed_mpfr_const_pi (SeedContext ctx,
     return seed_value_from_int(ctx, ret, except);
 }
 
+static SeedValue
+seed_mpfr_const_euler (SeedContext ctx,
+                       SeedObject function,
+                       SeedObject this_object,
+                       gsize arg_count,
+                       const SeedValue args[],
+                       SeedException * except)
+{
+    mpfr_rnd_t rnd;
+    mpfr_ptr rop;
+    gint ret;
+
+    if ( arg_count != 1 )
+    {
+        EXPECTED_EXCEPTION("mpfr.euler", "1");
+    }
+
+    rop = seed_object_get_private(this_object);
+    rnd = seed_value_to_mpfr_rnd_t(ctx, args[0], except);
+
+    ret = mpfr_const_euler(rop, rnd);
+
+    return seed_value_from_int(ctx, ret, except);
+}
+
+static SeedValue
+seed_mpfr_const_catalan (SeedContext ctx,
+                         SeedObject function,
+                         SeedObject this_object,
+                         gsize arg_count,
+                         const SeedValue args[],
+                         SeedException * except)
+{
+    mpfr_rnd_t rnd;
+    mpfr_ptr rop;
+    gint ret;
+
+    if ( arg_count != 1 )
+    {
+        EXPECTED_EXCEPTION("mpfr.catalan", "1");
+    }
+
+    rop = seed_object_get_private(this_object);
+    rnd = seed_value_to_mpfr_rnd_t(ctx, args[0], except);
+
+    ret = mpfr_const_catalan(rop, rnd);
+
+    return seed_value_from_int(ctx, ret, except);
+}
+
 /* This is a bit disgusting. Oh well. */
 static SeedValue
 seed_mpfr_add (SeedContext ctx,
@@ -420,6 +470,8 @@ seed_static_function mpfr_funcs[] =
     {"set", seed_mpfr_set, 0},
     {"out_str", seed_mpfr_out_str, 0},
     {"pi", seed_mpfr_const_pi, 0},
+    {"euler", seed_mpfr_const_pi, 0},
+    {"catalan", seed_mpfr_const_pi, 0},
     {NULL, NULL, 0}
 };
 



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