[seed] [mpfr] Added mpfr.prec_round
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] [mpfr] Added mpfr.prec_round
- Date: Mon, 6 Jul 2009 03:11:19 +0000 (UTC)
commit bda517ed18032de986345e84a7b500af8fde0d97
Author: Matt ARSENAULT <arsenm2 rpi edu>
Date: Sun Jul 5 19:51:13 2009 -0400
[mpfr] Added mpfr.prec_round
modules/mpfr/seed-mpfr-arithmetic.c | 23 +++++++++++++++++++++++
modules/mpfr/seed-mpfr.c | 1 +
modules/mpfr/seed-mpfr.h | 2 ++
3 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/modules/mpfr/seed-mpfr-arithmetic.c b/modules/mpfr/seed-mpfr-arithmetic.c
index db9690b..2c9f279 100644
--- a/modules/mpfr/seed-mpfr-arithmetic.c
+++ b/modules/mpfr/seed-mpfr-arithmetic.c
@@ -748,3 +748,26 @@ SeedValue seed_mpfr_max (SeedContext ctx,
return seed_value_from_int(ctx, ret, exception);
}
+SeedValue seed_mpfr_prec_round (SeedContext ctx,
+ SeedObject function,
+ SeedObject this_object,
+ gsize argument_count,
+ const SeedValue args[],
+ SeedException * exception)
+{
+ mpfr_rnd_t rnd;
+ mp_prec_t prec;
+ mpfr_ptr rop;
+ gint ret;
+
+ CHECK_ARG_COUNT("mpfr.prec_round", 2);
+
+ rop = seed_object_get_private(this_object);
+ prec = seed_value_to_mpfr_prec_t(ctx, args[0], exception);
+ rnd = seed_value_to_mpfr_rnd_t(ctx, args[1], exception);
+
+ ret = mpfr_prec_round(rop, prec, rnd);
+
+ return seed_value_from_int(ctx, ret, exception);
+}
+
diff --git a/modules/mpfr/seed-mpfr.c b/modules/mpfr/seed-mpfr.c
index a273862..f78ce36 100644
--- a/modules/mpfr/seed-mpfr.c
+++ b/modules/mpfr/seed-mpfr.c
@@ -636,6 +636,7 @@ seed_static_function mpfr_funcs[] =
{"floor", seed_mpfr_floor, 0},
{"round", seed_mpfr_round, 0},
{"trunc", seed_mpfr_trunc, 0},
+ {"prec_round", seed_mpfr_prec_round, 0},
{"nexttoward", seed_mpfr_nexttoward, 0},
{"nextabove", seed_mpfr_nextabove, 0},
{"nextbelow", seed_mpfr_nextbelow, 0},
diff --git a/modules/mpfr/seed-mpfr.h b/modules/mpfr/seed-mpfr.h
index a42ea36..f112028 100644
--- a/modules/mpfr/seed-mpfr.h
+++ b/modules/mpfr/seed-mpfr.h
@@ -69,6 +69,8 @@ DEF_SEED_MPFR_FUNC(seed_mpfr_nexttoward);
DEF_SEED_MPFR_FUNC(seed_mpfr_nextabove);
DEF_SEED_MPFR_FUNC(seed_mpfr_nextbelow);
+DEF_SEED_MPFR_FUNC(seed_mpfr_prec_round);
+
DEF_SEED_MPFR_FUNC(seed_mpfr_min);
DEF_SEED_MPFR_FUNC(seed_mpfr_max);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]