[seed] [mpfr] Implement inverse trig functions



commit 24882acbee597b5bd129d3dfebb5c733bc7217c1
Author: Matt ARSENAULT <arsenm2 rpi edu>
Date:   Sun Jul 5 02:12:06 2009 -0400

    [mpfr] Implement inverse trig functions

 modules/mpfr/seed-mpfr-trig.c |   91 +++++++++++++++++++++++++++++++++++++++++
 modules/mpfr/seed-mpfr.h      |    4 ++
 2 files changed, 95 insertions(+), 0 deletions(-)
---
diff --git a/modules/mpfr/seed-mpfr-trig.c b/modules/mpfr/seed-mpfr-trig.c
index 5315caa..21e4e15 100644
--- a/modules/mpfr/seed-mpfr-trig.c
+++ b/modules/mpfr/seed-mpfr-trig.c
@@ -183,3 +183,94 @@ SeedValue seed_mpfr_cot (SeedContext ctx,
     return seed_value_from_int(ctx, ret, exception);
 }
 
+SeedValue seed_mpfr_asin (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.asin", 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.asin", "mpfr_t");
+    }
+
+    ret = mpfr_asin(rop, op, rnd);
+
+    return seed_value_from_int(ctx, ret, exception);
+}
+
+
+SeedValue seed_mpfr_acos (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.acos", 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.acos", "mpfr_t");
+    }
+
+    ret = mpfr_acos(rop, op, rnd);
+
+    return seed_value_from_int(ctx, ret, exception);
+}
+
+SeedValue seed_mpfr_atan (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.atan", 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.atan", "mpfr_t");
+    }
+
+    ret = mpfr_atan(rop, op, rnd);
+
+    return seed_value_from_int(ctx, ret, exception);
+}
+
diff --git a/modules/mpfr/seed-mpfr.h b/modules/mpfr/seed-mpfr.h
index 35776e2..24109e7 100644
--- a/modules/mpfr/seed-mpfr.h
+++ b/modules/mpfr/seed-mpfr.h
@@ -63,5 +63,9 @@ DEF_SEED_MPFR_FUNC(seed_mpfr_csc);
 DEF_SEED_MPFR_FUNC(seed_mpfr_sec);
 DEF_SEED_MPFR_FUNC(seed_mpfr_cot);
 
+DEF_SEED_MPFR_FUNC(seed_mpfr_asin);
+DEF_SEED_MPFR_FUNC(seed_mpfr_acos);
+DEF_SEED_MPFR_FUNC(seed_mpfr_atan);
+
 #endif      /* _SEED_MFPR_H_ */
 



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