[seed] [mpfr] Added mpfr.sqrt
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] [mpfr] Added mpfr.sqrt
- Date: Sun, 5 Jul 2009 19:08:49 +0000 (UTC)
commit d7784d2347a8437774e2ecd87a5f18c2539e4f35
Author: Matt ARSENAULT <arsenm2 rpi edu>
Date: Sun Jul 5 11:35:42 2009 -0400
[mpfr] Added mpfr.sqrt
modules/mpfr/seed-mpfr-arithmetic.c | 31 +++++++++++++++++++++++++++++++
modules/mpfr/seed-mpfr.c | 1 +
modules/mpfr/seed-mpfr.h | 2 ++
3 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/modules/mpfr/seed-mpfr-arithmetic.c b/modules/mpfr/seed-mpfr-arithmetic.c
index eccc98d..2eabf15 100644
--- a/modules/mpfr/seed-mpfr-arithmetic.c
+++ b/modules/mpfr/seed-mpfr-arithmetic.c
@@ -64,3 +64,34 @@ SeedValue seed_mpfr_add (SeedContext ctx,
return seed_value_from_int(ctx, ret, exception);
}
+
+SeedValue seed_mpfr_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.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.sqrt", "mpfr_t");
+ }
+
+ ret = mpfr_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 7bc6464..58ac8d4 100644
--- a/modules/mpfr/seed-mpfr.c
+++ b/modules/mpfr/seed-mpfr.c
@@ -602,6 +602,7 @@ seed_mpfr_construct(SeedContext ctx,
seed_static_function mpfr_funcs[] =
{
{"add", seed_mpfr_add, 0},
+ {"sqrt", seed_mpfr_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 b691c75..07796d3 100644
--- a/modules/mpfr/seed-mpfr.h
+++ b/modules/mpfr/seed-mpfr.h
@@ -83,5 +83,7 @@ DEF_SEED_MPFR_FUNC(seed_mpfr_asinh);
DEF_SEED_MPFR_FUNC(seed_mpfr_acosh);
DEF_SEED_MPFR_FUNC(seed_mpfr_atanh);
+DEF_SEED_MPFR_FUNC(seed_mpfr_sqrt);
+
#endif /* _SEED_MFPR_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]