[seed] [mpfr] log functions
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] [mpfr] log functions
- Date: Sun, 5 Jul 2009 06:54:04 +0000 (UTC)
commit 1acdc8bb40cf8270de9c641c6b4575a13cc9d3cf
Author: Matt ARSENAULT <arsenm2 rpi edu>
Date: Sun Jul 5 02:20:45 2009 -0400
[mpfr] log functions
modules/mpfr/seed-mpfr-trig.c | 93 +++++++++++++++++++++++++++++++++++++++++
modules/mpfr/seed-mpfr.c | 3 +
modules/mpfr/seed-mpfr.h | 4 ++
3 files changed, 100 insertions(+), 0 deletions(-)
---
diff --git a/modules/mpfr/seed-mpfr-trig.c b/modules/mpfr/seed-mpfr-trig.c
index 21e4e15..f392a20 100644
--- a/modules/mpfr/seed-mpfr-trig.c
+++ b/modules/mpfr/seed-mpfr-trig.c
@@ -274,3 +274,96 @@ SeedValue seed_mpfr_atan (SeedContext ctx,
return seed_value_from_int(ctx, ret, exception);
}
+
+/* log functions */
+
+SeedValue seed_mpfr_log (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.log", 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.log", "mpfr_t");
+ }
+
+ ret = mpfr_log(rop, op, rnd);
+
+ return seed_value_from_int(ctx, ret, exception);
+}
+
+SeedValue seed_mpfr_log2 (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.log2", 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.log2", "mpfr_t");
+ }
+
+ ret = mpfr_log2(rop, op, rnd);
+
+ return seed_value_from_int(ctx, ret, exception);
+}
+
+SeedValue seed_mpfr_log10 (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.log10", 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.log10", "mpfr_t");
+ }
+
+ ret = mpfr_log10(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 62ec8fb..5763a73 100644
--- a/modules/mpfr/seed-mpfr.c
+++ b/modules/mpfr/seed-mpfr.c
@@ -340,6 +340,9 @@ seed_static_function mpfr_funcs[] =
{"csc", seed_mpfr_csc, 0},
{"sec", seed_mpfr_sec, 0},
{"cot", seed_mpfr_cot, 0},
+ {"log", seed_mpfr_log, 0},
+ {"log2", seed_mpfr_log2, 0},
+ {"log10", seed_mpfr_log10, 0},
{"set", seed_mpfr_set, 0},
{"out_str", seed_mpfr_out_str, 0},
{"pi", seed_mpfr_const_pi, 0},
diff --git a/modules/mpfr/seed-mpfr.h b/modules/mpfr/seed-mpfr.h
index 24109e7..4cf4d97 100644
--- a/modules/mpfr/seed-mpfr.h
+++ b/modules/mpfr/seed-mpfr.h
@@ -67,5 +67,9 @@ DEF_SEED_MPFR_FUNC(seed_mpfr_asin);
DEF_SEED_MPFR_FUNC(seed_mpfr_acos);
DEF_SEED_MPFR_FUNC(seed_mpfr_atan);
+DEF_SEED_MPFR_FUNC(seed_mpfr_log);
+DEF_SEED_MPFR_FUNC(seed_mpfr_log2);
+DEF_SEED_MPFR_FUNC(seed_mpfr_log10);
+
#endif /* _SEED_MFPR_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]