[seed] [mpfr] Added mpfr.sqr
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] [mpfr] Added mpfr.sqr
- Date: Thu, 9 Jul 2009 01:48:43 +0000 (UTC)
commit c6fdb66f865aa6d520845a3f4fee50b758bc8dd0
Author: Matt ARSENAULT <arsenm2 rpi edu>
Date: Wed Jul 8 18:26:10 2009 -0400
[mpfr] Added mpfr.sqr
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 53d9653..c71bbf9 100644
--- a/modules/mpfr/seed-mpfr-arithmetic.c
+++ b/modules/mpfr/seed-mpfr-arithmetic.c
@@ -307,6 +307,36 @@ SeedValue seed_mpfr_rec_sqrt (SeedContext ctx,
return seed_value_from_int(ctx, ret, exception);
}
+SeedValue seed_mpfr_sqr (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.sqr", 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.sqr", "mpfr_t");
+ }
+
+ ret = mpfr_sqr(rop, op, rnd);
+
+ return seed_value_from_int(ctx, ret, exception);
+}
+
SeedValue seed_mpfr_cbrt (SeedContext ctx,
SeedObject function,
SeedObject this_object,
diff --git a/modules/mpfr/seed-mpfr.c b/modules/mpfr/seed-mpfr.c
index 0944fd8..cb67d85 100644
--- a/modules/mpfr/seed-mpfr.c
+++ b/modules/mpfr/seed-mpfr.c
@@ -991,6 +991,7 @@ seed_static_function mpfr_funcs[] =
{"mul", seed_mpfr_mul, 0},
{"div", seed_mpfr_div, 0},
{"sqrt", seed_mpfr_sqrt, 0},
+ {"sqr", seed_mpfr_sqr, 0},
{"rec_sqrt", seed_mpfr_rec_sqrt, 0},
{"cbrt", seed_mpfr_cbrt, 0},
{"neg", seed_mpfr_neg, 0},
diff --git a/modules/mpfr/seed-mpfr.h b/modules/mpfr/seed-mpfr.h
index c0fe920..833b6b1 100644
--- a/modules/mpfr/seed-mpfr.h
+++ b/modules/mpfr/seed-mpfr.h
@@ -120,6 +120,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_sqr);
DEF_SEED_MPFR_FUNC(seed_mpfr_rec_sqrt);
DEF_SEED_MPFR_FUNC(seed_mpfr_cbrt);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]