[seed] [mpfr] Added mpfr.hypot
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] [mpfr] Added mpfr.hypot
- Date: Sun, 5 Jul 2009 20:36:19 +0000 (UTC)
commit c580721293d0da555710c7eac2172b3af011e9fa
Author: Matt ARSENAULT <arsenm2 rpi edu>
Date: Sun Jul 5 16:26:52 2009 -0400
[mpfr] Added mpfr.hypot
modules/mpfr/seed-mpfr-trig.c | 32 ++++++++++++++++++++++++++++++++
modules/mpfr/seed-mpfr.c | 1 +
modules/mpfr/seed-mpfr.h | 1 +
3 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/modules/mpfr/seed-mpfr-trig.c b/modules/mpfr/seed-mpfr-trig.c
index 51f207e..e6a10ca 100644
--- a/modules/mpfr/seed-mpfr-trig.c
+++ b/modules/mpfr/seed-mpfr-trig.c
@@ -1181,3 +1181,35 @@ SeedValue seed_mpfr_agm (SeedContext ctx,
return seed_value_from_int(ctx, ret, exception);
}
+SeedValue seed_mpfr_hypot (SeedContext ctx,
+ SeedObject function,
+ SeedObject this_object,
+ gsize argument_count,
+ const SeedValue args[],
+ SeedException * exception)
+{
+ mpfr_rnd_t rnd;
+ mpfr_ptr rop, op1, op2;
+ gint ret;
+
+ CHECK_ARG_COUNT("mpfr.hypot", 3);
+
+ rop = seed_object_get_private(this_object);
+ rnd = seed_value_to_mpfr_rnd_t(ctx, args[2], exception);
+
+ if ( seed_value_is_object_of_class(ctx, args[0], mpfr_class) &&
+ seed_value_is_object_of_class(ctx, args[1], mpfr_class))
+ {
+ op1 = seed_object_get_private(args[0]);
+ op2 = seed_object_get_private(args[1]);
+ }
+ else
+ {
+ TYPE_EXCEPTION("mpfr.agm", "mpfr_t");
+ }
+
+ ret = mpfr_hypot(rop, op1, op2, rnd);
+
+ return seed_value_from_int(ctx, ret, exception);
+}
+
diff --git a/modules/mpfr/seed-mpfr.c b/modules/mpfr/seed-mpfr.c
index 28d4830..1fca9e6 100644
--- a/modules/mpfr/seed-mpfr.c
+++ b/modules/mpfr/seed-mpfr.c
@@ -643,6 +643,7 @@ seed_static_function mpfr_funcs[] =
{"fma", seed_mpfr_fma, 0},
{"fms", seed_mpfr_fms, 0},
{"agm", seed_mpfr_agm, 0},
+ {"hypot", seed_mpfr_hypot, 0},
{"set", seed_mpfr_set, 0},
{"set_inf", seed_mpfr_set_inf, 0},
{"set_nan", seed_mpfr_set_nan, 0},
diff --git a/modules/mpfr/seed-mpfr.h b/modules/mpfr/seed-mpfr.h
index 48eda42..62cc13e 100644
--- a/modules/mpfr/seed-mpfr.h
+++ b/modules/mpfr/seed-mpfr.h
@@ -123,6 +123,7 @@ DEF_SEED_MPFR_FUNC(seed_mpfr_yn);
DEF_SEED_MPFR_FUNC(seed_mpfr_fma);
DEF_SEED_MPFR_FUNC(seed_mpfr_fms);
DEF_SEED_MPFR_FUNC(seed_mpfr_agm);
+DEF_SEED_MPFR_FUNC(seed_mpfr_hypot);
#endif /* _SEED_MFPR_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]