bigdecimal-math_r 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +63 -10
- data/changelog.md +32 -0
- data/ext/bigdecimal/math_r/algofunc.h +11 -1
- data/ext/bigdecimal/math_r/api/bigmath/const_e.h +1 -1
- data/ext/bigdecimal/math_r/api/bigmath/const_euler_gamma.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/csqrt.h +1 -1
- data/ext/bigdecimal/math_r/api/kernel/rb_BigDecimal_flo.h +8 -2
- data/ext/bigdecimal/math_r/api/numeric/domain_p.h +7 -0
- data/ext/bigdecimal/math_r/api/numeric/nan_p.h +4 -1
- data/ext/bigdecimal/math_r/api.h +2 -0
- data/ext/bigdecimal/math_r/const.c +42 -5
- data/ext/bigdecimal/math_r/decl.h +11 -1
- data/ext/bigdecimal/math_r/exp.c +45 -3
- data/ext/bigdecimal/math_r/extconf.rb +5 -1
- data/ext/bigdecimal/math_r/{gamma_r.c → gamma_beta.c} +11 -78
- data/ext/bigdecimal/math_r/internal/algo/bigmath/E/{ser.h → napier.h} +1 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/EulerGamma/borwein_bailey.h +37 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/LOG10/ser.h +4 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/LOG_PI/builtin.h +3 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/SQRT2/builtin.h +4 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/SQRT3/builtin.h +4 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acos/branch.h +11 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acosh/branch.h +2 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acosh/edom.h +7 -5
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acot/logrep.h +9 -6
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acoth/branch.h +4 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acoth/edom.h +4 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acoth/logrep.h +5 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acsc/branch.h +3 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acsc/edom.h +7 -6
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acsc/logrep.h +6 -5
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acsch/branch.h +3 -9
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acsch/logrep.h +7 -6
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asec/branch.h +7 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asec/edom.h +7 -6
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asec/logrep.h +8 -7
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asech/branch.h +2 -5
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asech/edom.h +10 -6
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asech/logrep.h +3 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asin/branch.h +4 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asin/edom.h +6 -5
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asin/logrep.h +3 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asin/ser.h +1 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asinh/logrep.h +6 -5
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asinh/ser.h +1 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atan/branch.h +1 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atan/logrep.h +7 -6
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atan/ser_euler.h +4 -50
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atan/ser_usual.h +2 -9
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atanh/branch.h +4 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atanh/edom.h +6 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atanh/logrep.h +2 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atanh/ser.h +1 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cabs/formula.h +6 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacos/logrep.h +7 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacosh/logrep.h +6 -5
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacot/logrep.h +3 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacoth/logrep.h +8 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacsc/logrep.h +5 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacsch/logrep.h +7 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/carg/formula.h +6 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/casec/logrep.h +5 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/casech/logrep.h +3 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/casin/logrep.h +6 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/casinh/logrep.h +1 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/catan/logrep.h +3 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/catanh/logrep.h +5 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccbrt/branch.h +40 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccbrt/formula.h +5 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccos/eulerf.h +4 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccosh/eulerf.h +4 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccot/eulerf.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccoth/eulerf.h +4 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccsc/eulerf.h +4 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccsch/eulerf.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cexp/eulerf.h +10 -7
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cexp2/eulerf.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cexpm1/branch.h +13 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cexpm1/identity.h +17 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/clog/branch.h +11 -12
- data/ext/bigdecimal/math_r/internal/algo/bigmath/clog10/branch.h +53 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/clog10/formula.h +4 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/clog2/branch.h +53 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/clog2/formula.h +4 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cos/eulerf.h +6 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cos/ser.h +4 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cosh/eulerf.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cosh/formula.h +5 -5
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cosh/ser.h +4 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cot/eulerf.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cot/ser.h +3 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/coth/eulerf.h +4 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/coth/formula.h +1 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/coth/ser.h +3 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cpow/formula.h +9 -7
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csc/eulerf.h +4 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csc/ser.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csch/eulerf.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csch/formula.h +2 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csch/ser.h +6 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csec/eulerf.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csech/eulerf.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csin/eulerf.h +4 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csinh/eulerf.h +4 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csqrt/branch.h +40 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csqrt/formula.h +13 -43
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ctan/eulerf.h +4 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ctanh/eulerf.h +4 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cuberoot/branch.h +18 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cuberoot/newton.h +4 -12
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erf/algo911.h +7 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erf/cf.h +1 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erf/ser_inf.h +1 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erf/ser_zero.h +1 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erfc/algo911.h +5 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erfc/cf.h +1 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/escalb/edf.h +2 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/exp/builtin.h +7 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/exp/edf.h +6 -5
- data/ext/bigdecimal/math_r/internal/algo/bigmath/exp2/edf.h +9 -5
- data/ext/bigdecimal/math_r/internal/algo/bigmath/expm1/branch.h +13 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/expm1/identity.h +18 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/expxt/edf.h +1 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/f_euler/formula.h +3 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/hypot/l2norm.h +5 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/hypot/mmm.h +1 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ipow/edf.h +6 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/l2norm/formula.h +6 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log/branch.h +6 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log/builtin.h +3 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log/edf.h +8 -5
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log/edom.h +10 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log/mercator.h +7 -9
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log/ser_okumura.h +4 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log10/edf.h +3 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log10/mercator.h +9 -9
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log1p/branch.h +8 -5
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log1p/ser_mercator.h +16 -6
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log2/branch.h +1 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log2/edf.h +3 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log2/mercator.h +9 -9
- data/ext/bigdecimal/math_r/internal/algo/bigmath/logxt/edf.h +6 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/pow/formula.h +13 -8
- data/ext/bigdecimal/math_r/internal/algo/bigmath/rcm10/edf.h +10 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/rcm2/edf.h +11 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sec/eulerf.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sec/ser.h +6 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sech/eulerf.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sech/formula.h +8 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sech/ser.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sin/eulerf.h +5 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sin/ser.h +4 -5
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sincos/ser.h +9 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sinh/eulerf.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sinh/formula.h +8 -4
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sinh/ser.h +4 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sinhcosh/ser.h +10 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sqrt/branch.h +2 -1
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sqrt/builtin.h +2 -2
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sqrt/edom.h +1 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/tan/eulerf.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/tan/ser.h +3 -8
- data/ext/bigdecimal/math_r/internal/algo/bigmath/tanh/eulerf.h +5 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/tanh/formula.h +7 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/tanh/ser.h +3 -3
- data/ext/bigdecimal/math_r/internal/algo/bigmath/trig/f_euler.h +11 -5
- data/ext/bigdecimal/math_r/log.c +5 -5
- data/ext/bigdecimal/math_r/math_r/bigdecimal.h +5 -1
- data/ext/bigdecimal/math_r/math_r/bigmath.h +2 -0
- data/ext/bigdecimal/math_r/math_r/globals.h +1 -1
- data/ext/bigdecimal/math_r/math_r/numeric.h +1 -0
- data/ext/bigdecimal/math_r/math_r.c +14 -3
- data/ext/bigdecimal/math_r/solver.c +75 -21
- data/lib/bigdecimal/math_r/const/E_euler.rb +46 -0
- data/lib/bigdecimal/math_r/version.rb +1 -1
- data/lib/bigdecimal/math_r.rb +1 -0
- metadata +21 -11
- data/.ruby-version +0 -1
- data/LICENSE.txt +0 -21
- data/lib/bigdecimal/math_r.so +0 -0
@@ -3,15 +3,25 @@ log1p_ser_mercator(VALUE x, VALUE prec)
|
|
3
3
|
{
|
4
4
|
const ID div = rb_intern("div");
|
5
5
|
const ID mult = rb_intern("mult");
|
6
|
-
VALUE n
|
7
|
-
VALUE one
|
8
|
-
VALUE w
|
9
|
-
VALUE t
|
10
|
-
VALUE d
|
11
|
-
VALUE y
|
6
|
+
VALUE n;
|
7
|
+
VALUE one;
|
8
|
+
VALUE w;
|
9
|
+
VALUE t;
|
10
|
+
VALUE d;
|
11
|
+
VALUE y;
|
12
12
|
int sign = 1;
|
13
13
|
VALUE m = Qundef;
|
14
14
|
|
15
|
+
rb_check_precise(prec);
|
16
|
+
n = rb_numdiff_make_n(prec);
|
17
|
+
|
18
|
+
one = BIG_ONE;
|
19
|
+
t = one;
|
20
|
+
d = BIG_ONE;
|
21
|
+
y = BIG_ZERO;
|
22
|
+
|
23
|
+
w = rb_num_canonicalize(x, n, ARG_REAL, ARG_RAWVALUE);
|
24
|
+
|
15
25
|
while (rb_numdiff_condition_p(y, d, n, &m))
|
16
26
|
{
|
17
27
|
d = rb_funcall(w, div, 2, t, m);
|
@@ -29,7 +29,7 @@ log2_branch(VALUE x, VALUE prec, bigmath_func1 log2_cb)
|
|
29
29
|
VALUE exp, fra;
|
30
30
|
fra = rcm2_edf(x, &exp);
|
31
31
|
exp = rb_BigDecimal1(exp);
|
32
|
-
fra = log2_cb(fra, prec);
|
32
|
+
fra = log2_cb(fra, rb_numdiff_make_n(prec));
|
33
33
|
y = rb_funcall(exp, add, 2, fra, prec);
|
34
34
|
}
|
35
35
|
else
|
@@ -1,11 +1,12 @@
|
|
1
1
|
VALUE
|
2
2
|
log2_edf(VALUE x, VALUE prec)
|
3
3
|
{
|
4
|
-
VALUE y = Qundef;
|
4
|
+
VALUE y = Qundef, n;
|
5
5
|
|
6
6
|
rb_check_precise(prec);
|
7
|
+
n = rb_numdiff_make_n(prec);
|
7
8
|
|
8
|
-
y = logxt_edf(x, INT2FIX(2),
|
9
|
+
y = logxt_edf(x, INT2FIX(2), n);
|
9
10
|
|
10
11
|
return rb_num_round(y, prec);
|
11
12
|
}
|
@@ -17,19 +17,19 @@ VALUE
|
|
17
17
|
log2_mercator(VALUE x, VALUE prec)
|
18
18
|
{
|
19
19
|
const ID div = rb_intern("div");
|
20
|
-
VALUE
|
20
|
+
VALUE temp = Qundef, y = Qundef, n;
|
21
21
|
|
22
22
|
rb_check_precise(prec);
|
23
|
+
n = rb_numdiff_make_n(prec);
|
23
24
|
|
24
|
-
|
25
|
+
y = rb_funcall1(x, '-', INT2FIX(1));
|
26
|
+
temp = rb_funcall(y, div, 2, temp, n);
|
27
|
+
temp = rb_num_uminus(temp);
|
28
|
+
temp = log1p_ser_mercator(temp, n);
|
29
|
+
temp = rb_num_uminus(temp);
|
30
|
+
temp = rb_funcall(temp, div, 2, rb_bigmath_const_log2(n), n);
|
25
31
|
|
26
|
-
y =
|
27
|
-
fra = rb_funcall(y, div, 2, fra, prec);
|
28
|
-
fra = rb_num_uminus(fra);
|
29
|
-
fra = log1p_ser_mercator(fra, prec);
|
30
|
-
fra = rb_num_uminus(fra);
|
31
|
-
fra = rb_funcall(fra, div, 2, rb_bigmath_const_log2(prec), prec);
|
32
|
+
y = temp;
|
32
33
|
|
33
|
-
y = rb_funcall1(exp, '+', fra);
|
34
34
|
return rb_num_round(y, prec);
|
35
35
|
}
|
@@ -4,7 +4,12 @@ logxt_edf(VALUE x, VALUE t, VALUE prec)
|
|
4
4
|
const ID mult = rb_intern("mult");
|
5
5
|
VALUE a, b, s, one_half, n, m;
|
6
6
|
|
7
|
+
rb_check_precise(prec);
|
7
8
|
n = rb_numdiff_make_n(prec);
|
9
|
+
|
10
|
+
if (!rb_num_finite_p(x) || !rb_num_finite_p(t))
|
11
|
+
return BIG_NAN;
|
12
|
+
|
8
13
|
a = rb_num_canonicalize(x, n, ARG_REAL, ARG_RAWVALUE);
|
9
14
|
b = BIG_ONE;
|
10
15
|
s = BIG_ZERO;
|
@@ -29,5 +34,5 @@ logxt_edf(VALUE x, VALUE t, VALUE prec)
|
|
29
34
|
RB_GC_GUARD(s);
|
30
35
|
RB_GC_GUARD(one_half);
|
31
36
|
|
32
|
-
return s;
|
37
|
+
return rb_num_round(s, prec);
|
33
38
|
}
|
@@ -1,30 +1,35 @@
|
|
1
1
|
VALUE
|
2
2
|
pow_formula(VALUE x, VALUE y, VALUE prec)
|
3
3
|
{
|
4
|
-
VALUE a = Qundef;
|
4
|
+
VALUE a = Qundef, n;
|
5
5
|
|
6
6
|
rb_check_precise(prec);
|
7
|
+
n = rb_numdiff_make_n(prec);
|
8
|
+
|
7
9
|
if (!rb_num_real_p(x))
|
8
|
-
|
10
|
+
goto not_a_real_error;
|
9
11
|
if (rb_num_zero_p(rb_num_real(x)))
|
10
12
|
a = BIG_ONE;
|
11
13
|
if (TYPE(y) == T_FIXNUM || TYPE(y) == T_BIGNUM)
|
12
14
|
{
|
13
15
|
if (rb_num_positive_p(rb_num_real(x)))
|
14
|
-
a = ipow_edf(x, y,
|
16
|
+
a = ipow_edf(x, y, n);
|
15
17
|
else // if (rb_num_negative_p(rb_num_real(x)))
|
16
|
-
a = rb_num_uminus(ipow_edf(rb_num_abs(x), y,
|
18
|
+
a = rb_num_uminus(ipow_edf(rb_num_abs(x), y, n));
|
17
19
|
}
|
18
20
|
else if (rb_num_real_p(y))
|
19
21
|
{
|
20
|
-
a = rb_bigmath_log(rb_num_abs(x),
|
22
|
+
a = rb_bigmath_log(rb_num_abs(x), n);
|
21
23
|
a = rb_funcall1(y, '*', a);
|
22
|
-
a = rb_bigmath_exp(a,
|
24
|
+
a = rb_bigmath_exp(a, n);
|
23
25
|
if (rb_num_negative_p(x))
|
24
26
|
a = rb_num_uminus(a);
|
25
27
|
}
|
26
28
|
else
|
27
|
-
|
29
|
+
goto not_a_real_error;
|
30
|
+
|
31
|
+
return rb_num_round(a, prec);
|
28
32
|
|
29
|
-
|
33
|
+
not_a_real_error:
|
34
|
+
rb_raise(rb_eTypeError, "not a Real");
|
30
35
|
}
|
@@ -4,7 +4,9 @@ rcm10_edf(VALUE x, VALUE *reso)
|
|
4
4
|
VALUE fra = x; *reso = INT2FIX(0);
|
5
5
|
if (rb_num_nonzero_p(fra) && rb_num_finite_p(fra))
|
6
6
|
{
|
7
|
-
|
7
|
+
const ID succ = rb_intern("succ");
|
8
|
+
const ID pred = rb_intern("pred");
|
9
|
+
VALUE resov = LONG2FIX(0);
|
8
10
|
bool has_sign = RTEST(rb_num_coerce_cmp(x, INT2FIX(0), '<'));
|
9
11
|
VALUE rat_ten = rb_rational_new1(INT2FIX(10));
|
10
12
|
fra = rb_Rational1(fra);
|
@@ -15,7 +17,9 @@ rcm10_edf(VALUE x, VALUE *reso)
|
|
15
17
|
while (RTEST(rb_num_coerce_cmp(fra, INT2FIX(10), rb_intern(">="))))
|
16
18
|
{
|
17
19
|
fra = rb_funcall1(fra, '/', rat_ten);
|
18
|
-
resov
|
20
|
+
resov = TYPE(resov) == T_FIXNUM ?
|
21
|
+
LONG2FIX(FIX2LONG(resov) + 1) :
|
22
|
+
rb_funcall(resov, succ, 0);
|
19
23
|
}
|
20
24
|
}
|
21
25
|
else if (RTEST(rb_num_coerce_cmp(fra, INT2FIX(1), '<')))
|
@@ -23,12 +27,14 @@ rcm10_edf(VALUE x, VALUE *reso)
|
|
23
27
|
while (RTEST(rb_num_coerce_cmp(fra, INT2FIX(1), '<')))
|
24
28
|
{
|
25
29
|
fra = rb_funcall1(fra, '*', rat_ten);
|
26
|
-
resov
|
30
|
+
resov = TYPE(resov) == T_FIXNUM ?
|
31
|
+
LONG2FIX(FIX2LONG(resov) - 1) :
|
32
|
+
rb_funcall(resov, pred, 0);
|
27
33
|
}
|
28
34
|
}
|
29
35
|
if (has_sign)
|
30
36
|
fra = rb_num_uminus(fra);
|
31
|
-
*reso =
|
37
|
+
*reso = resov;
|
32
38
|
}
|
33
39
|
return fra;
|
34
40
|
}
|
@@ -1,10 +1,14 @@
|
|
1
1
|
VALUE
|
2
2
|
rcm2_edf(VALUE x, VALUE *reso)
|
3
3
|
{
|
4
|
+
|
4
5
|
VALUE fra = x; *reso = INT2FIX(0);
|
6
|
+
|
5
7
|
if (rb_num_nonzero_p(fra) && rb_num_finite_p(fra))
|
6
8
|
{
|
7
|
-
|
9
|
+
const ID succ = rb_intern("succ");
|
10
|
+
const ID pred = rb_intern("pred");
|
11
|
+
VALUE resov = LONG2FIX(0);
|
8
12
|
bool has_sign = RTEST(rb_num_coerce_cmp(x, INT2FIX(0), '<'));
|
9
13
|
VALUE rat_two = rb_rational_new1(INT2FIX(2));
|
10
14
|
fra = rb_Rational1(fra);
|
@@ -15,7 +19,9 @@ rcm2_edf(VALUE x, VALUE *reso)
|
|
15
19
|
while (RTEST(rb_num_coerce_cmp(INT2FIX(2), fra, rb_intern("<="))))
|
16
20
|
{
|
17
21
|
fra = rb_funcall1(fra, '/', rat_two);
|
18
|
-
resov
|
22
|
+
TYPE(resov) == T_FIXNUM ?
|
23
|
+
LONG2FIX(FIX2LONG(resov) + 1) :
|
24
|
+
rb_funcall(resov, succ, 0);
|
19
25
|
}
|
20
26
|
}
|
21
27
|
else
|
@@ -23,7 +29,9 @@ rcm2_edf(VALUE x, VALUE *reso)
|
|
23
29
|
while (RTEST(rb_num_coerce_cmp(INT2FIX(1), fra, '>')))
|
24
30
|
{
|
25
31
|
fra = rb_funcall1(fra, '*', rat_two);
|
26
|
-
resov
|
32
|
+
TYPE(resov) == T_FIXNUM ?
|
33
|
+
LONG2FIX(FIX2LONG(resov) - 1) :
|
34
|
+
rb_funcall(resov, pred, 0);
|
27
35
|
}
|
28
36
|
}
|
29
37
|
if (has_sign)
|
@@ -1,11 +1,13 @@
|
|
1
1
|
VALUE
|
2
2
|
sec_eulerf(VALUE z, VALUE prec)
|
3
3
|
{
|
4
|
-
VALUE w;
|
4
|
+
VALUE w, n;
|
5
5
|
|
6
6
|
rb_check_precise(prec);
|
7
|
+
n = rb_numdiff_make_n(prec);
|
7
8
|
|
8
|
-
w = trig_f_euler(mf_cos, rb_ImaginaryZ(z, SIGN_PLUS),
|
9
|
+
w = trig_f_euler(mf_cos, rb_ImaginaryZ(z, SIGN_PLUS), n);
|
10
|
+
w = rb_num_canonicalize(w, n, ARG_REAL, ARG_RECIPROCAL);
|
9
11
|
|
10
|
-
return
|
12
|
+
return rb_num_round(w, prec);
|
11
13
|
}
|
@@ -1,11 +1,13 @@
|
|
1
1
|
VALUE
|
2
2
|
sec_ser(VALUE x, VALUE prec)
|
3
3
|
{
|
4
|
-
VALUE
|
4
|
+
VALUE sec, n;
|
5
5
|
|
6
6
|
rb_check_precise(prec);
|
7
|
+
n = rb_numdiff_make_n(prec);
|
7
8
|
|
8
|
-
rb_bigmath_sincos(x,
|
9
|
-
|
10
|
-
|
9
|
+
rb_bigmath_sincos(x, n, NULL, &sec);
|
10
|
+
sec = rb_num_canonicalize(sec, n, ARG_REAL, ARG_RECIPROCAL);
|
11
|
+
|
12
|
+
return rb_num_round(sec, prec);
|
11
13
|
}
|
@@ -1,11 +1,13 @@
|
|
1
1
|
VALUE
|
2
2
|
sech_eulerf(VALUE x, VALUE prec)
|
3
3
|
{
|
4
|
-
VALUE y;
|
4
|
+
VALUE y = Qundef, n;
|
5
5
|
|
6
6
|
rb_check_precise(prec);
|
7
|
+
n = rb_numdiff_make_n(prec);
|
7
8
|
|
8
|
-
y = trig_f_euler(mf_cos, x,
|
9
|
+
y = trig_f_euler(mf_cos, x, n);
|
10
|
+
y = rb_num_canonicalize(y, n, ARG_REAL, ARG_RECIPROCAL);
|
9
11
|
|
10
|
-
return
|
12
|
+
return rb_num_round(y, prec);
|
11
13
|
}
|
@@ -2,9 +2,13 @@ VALUE
|
|
2
2
|
sech_formula(VALUE x, VALUE prec)
|
3
3
|
{
|
4
4
|
const ID div = rb_intern("div");
|
5
|
-
VALUE n =
|
6
|
-
|
7
|
-
|
5
|
+
VALUE n, t, two, y = Qundef;
|
6
|
+
|
7
|
+
rb_check_precise(prec);
|
8
|
+
n = rb_numdiff_make_n(prec);
|
9
|
+
|
10
|
+
t = rb_bigmath_exp(x, n);
|
11
|
+
two = rb_BigDecimal1(INT2FIX(2));
|
8
12
|
|
9
13
|
if (TYPE(t) == T_FIXNUM || TYPE(t) == T_BIGNUM)
|
10
14
|
{
|
@@ -16,7 +20,7 @@ sech_formula(VALUE x, VALUE prec)
|
|
16
20
|
y = BIG_ZERO;
|
17
21
|
else
|
18
22
|
{
|
19
|
-
y = rb_num_canonicalize(t,
|
23
|
+
y = rb_num_canonicalize(t, n, ARG_REAL, ARG_RECIPROCAL);
|
20
24
|
y = rb_funcall1(t, '+', y);
|
21
25
|
y = rb_funcall(two, div, 2, y, prec);
|
22
26
|
}
|
@@ -1,11 +1,13 @@
|
|
1
1
|
VALUE
|
2
2
|
sech_ser(VALUE x, VALUE prec)
|
3
3
|
{
|
4
|
-
VALUE y = Qundef;
|
4
|
+
VALUE y = Qundef, n;
|
5
5
|
|
6
6
|
rb_check_precise(prec);
|
7
|
+
n = rb_numdiff_make_n(prec);
|
7
8
|
|
8
|
-
sinhcosh_ser(x,
|
9
|
+
sinhcosh_ser(x, n, NULL, &y);
|
10
|
+
y = rb_num_canonicalize(y, n, ARG_REAL, ARG_RECIPROCAL);
|
9
11
|
|
10
|
-
return
|
12
|
+
return rb_num_round(y, prec);
|
11
13
|
}
|
@@ -2,10 +2,13 @@ VALUE
|
|
2
2
|
sin_eulerf(VALUE z, VALUE prec)
|
3
3
|
{
|
4
4
|
const ID sin = rb_intern("sin");
|
5
|
+
VALUE n;
|
5
6
|
|
6
7
|
rb_check_precise(prec);
|
8
|
+
n = rb_numdiff_make_n(prec);
|
7
9
|
|
8
|
-
z = trig_f_euler(sin, rb_ImaginaryZ(z, SIGN_PLUS),
|
10
|
+
z = trig_f_euler(sin, rb_ImaginaryZ(z, SIGN_PLUS), n);
|
11
|
+
z = rb_num_real(z);
|
9
12
|
|
10
|
-
return
|
13
|
+
return rb_num_round(z, prec);
|
11
14
|
}
|
@@ -1,13 +1,12 @@
|
|
1
1
|
VALUE
|
2
2
|
sin_ser(VALUE x, VALUE prec)
|
3
3
|
{
|
4
|
-
VALUE sin;
|
4
|
+
VALUE sin, n;
|
5
5
|
|
6
6
|
rb_check_precise(prec);
|
7
|
+
n = rb_numdiff_make_n(prec);
|
7
8
|
|
8
|
-
rb_bigmath_sincos(x,
|
9
|
+
rb_bigmath_sincos(x, n, &sin, NULL);
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
return sin;
|
11
|
+
return rb_num_round(sin, prec);
|
13
12
|
}
|
@@ -4,23 +4,28 @@ sincos_ser(VALUE x, VALUE prec, VALUE *sin, VALUE *cos)
|
|
4
4
|
const ID div = rb_intern("div");
|
5
5
|
VALUE n, m, f, w, a, y;
|
6
6
|
long i = 0;
|
7
|
-
|
7
|
+
|
8
8
|
if (sin == NULL && cos == NULL)
|
9
9
|
return;
|
10
|
-
|
10
|
+
|
11
|
+
|
11
12
|
if (!rb_num_finite_p(x))
|
12
13
|
{
|
13
14
|
if (sin != NULL) *sin = BIG_NAN;
|
14
15
|
if (cos != NULL) *cos = BIG_NAN;
|
15
16
|
return;
|
16
17
|
}
|
18
|
+
|
19
|
+
rb_check_precise(prec);
|
17
20
|
n = rb_numdiff_make_n(prec);
|
21
|
+
|
18
22
|
f = BIG_ONE;
|
19
23
|
w = BIG_ONE;
|
20
24
|
a = BIG_ONE;
|
21
25
|
y = BIG_ZERO;
|
22
26
|
if (sin != NULL) *sin = BIG_ZERO;
|
23
27
|
if (cos != NULL) *cos = BIG_ZERO;
|
28
|
+
|
24
29
|
while (rb_numdiff_condition_p(y, a, n, &m))
|
25
30
|
{
|
26
31
|
a = rb_funcall(w, div, 2, f, m);
|
@@ -41,10 +46,12 @@ sincos_ser(VALUE x, VALUE prec, VALUE *sin, VALUE *cos)
|
|
41
46
|
w = rb_funcall1(w, '*', x);
|
42
47
|
f = rb_funcall1(f, '*', LONG2NUM(++i));
|
43
48
|
}
|
49
|
+
|
44
50
|
RB_GC_GUARD(f);
|
45
51
|
RB_GC_GUARD(w);
|
46
52
|
RB_GC_GUARD(a);
|
47
53
|
RB_GC_GUARD(y);
|
54
|
+
|
48
55
|
if (sin != NULL) RB_GC_GUARD(*sin);
|
49
56
|
if (cos != NULL) RB_GC_GUARD(*cos);
|
50
57
|
}
|
@@ -1,11 +1,13 @@
|
|
1
1
|
VALUE
|
2
2
|
sinh_eulerf(VALUE x, VALUE prec)
|
3
3
|
{
|
4
|
-
VALUE y;
|
4
|
+
VALUE y = Qundef, n;
|
5
5
|
|
6
6
|
rb_check_precise(prec);
|
7
|
+
n = rb_numdiff_make_n(prec);
|
7
8
|
|
8
|
-
y = rb_ImaginaryZ(trig_f_euler(mf_sin, x,
|
9
|
+
y = rb_ImaginaryZ(trig_f_euler(mf_sin, x, n), SIGN_PLUS);
|
10
|
+
y = rb_num_real(y);
|
9
11
|
|
10
|
-
return
|
12
|
+
return rb_num_round(y, prec);
|
11
13
|
}
|
@@ -2,11 +2,15 @@ VALUE
|
|
2
2
|
sinh_formula(VALUE x, VALUE prec)
|
3
3
|
{
|
4
4
|
const ID div = rb_intern("div");
|
5
|
-
VALUE n =
|
6
|
-
VALUE t = rb_bigmath_exp(x, n), y = Qundef;
|
7
|
-
VALUE two = rb_BigDecimal1(INT2FIX(2));
|
5
|
+
VALUE n, t, y = Qundef, two;
|
8
6
|
int sign;
|
9
7
|
|
8
|
+
rb_check_precise(prec);
|
9
|
+
n = rb_numdiff_make_n(prec);
|
10
|
+
|
11
|
+
t = rb_bigmath_exp(x, n);
|
12
|
+
two = rb_BigDecimal1(INT2FIX(2));
|
13
|
+
|
10
14
|
if (TYPE(t) == T_FIXNUM || TYPE(t) == T_BIGNUM)
|
11
15
|
{
|
12
16
|
y = rb_Rational(INT2FIX(1), t);
|
@@ -17,7 +21,7 @@ sinh_formula(VALUE x, VALUE prec)
|
|
17
21
|
y = sign == 1 ? BIG_INF : BIG_MINUS_INF;
|
18
22
|
else
|
19
23
|
{
|
20
|
-
y = rb_num_canonicalize(t,
|
24
|
+
y = rb_num_canonicalize(t, n, ARG_REAL, ARG_RECIPROCAL);
|
21
25
|
y = rb_funcall1(t, '-', y);
|
22
26
|
y = rb_funcall(y, div, 2, two, prec);
|
23
27
|
}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
VALUE
|
2
2
|
sinh_ser(VALUE x, VALUE prec)
|
3
3
|
{
|
4
|
-
VALUE y = Qundef;
|
4
|
+
VALUE y = Qundef, n;
|
5
5
|
|
6
6
|
rb_check_precise(prec);
|
7
|
+
n = rb_numdiff_make_n(prec);
|
7
8
|
|
8
|
-
sinhcosh_ser(x,
|
9
|
+
sinhcosh_ser(x, n, &y, NULL);
|
9
10
|
|
10
|
-
return y;
|
11
|
+
return rb_num_round(y, prec);
|
11
12
|
}
|
@@ -10,9 +10,9 @@ sinhcosh_inline(VALUE x, VALUE prec, VALUE *sinh, VALUE *cosh)
|
|
10
10
|
w = BIG_ONE;
|
11
11
|
a = BIG_ONE;
|
12
12
|
y = BIG_ZERO;
|
13
|
-
|
14
13
|
if (sinh != NULL) *sinh = BIG_ZERO;
|
15
14
|
if (cosh != NULL) *cosh = BIG_ZERO;
|
15
|
+
|
16
16
|
while (rb_numdiff_condition_p(y, a, n, &m))
|
17
17
|
{
|
18
18
|
a = rb_funcall(w, div, 2, f, m);
|
@@ -27,10 +27,12 @@ sinhcosh_inline(VALUE x, VALUE prec, VALUE *sinh, VALUE *cosh)
|
|
27
27
|
w = rb_funcall1(w, '*', x);
|
28
28
|
f = rb_funcall1(f, '*', LONG2NUM(++i));
|
29
29
|
}
|
30
|
+
|
30
31
|
RB_GC_GUARD(f);
|
31
32
|
RB_GC_GUARD(w);
|
32
33
|
RB_GC_GUARD(a);
|
33
34
|
RB_GC_GUARD(y);
|
35
|
+
|
34
36
|
if (sinh != NULL) RB_GC_GUARD(*sinh);
|
35
37
|
if (cosh != NULL) RB_GC_GUARD(*cosh);
|
36
38
|
}
|
@@ -38,8 +40,13 @@ sinhcosh_inline(VALUE x, VALUE prec, VALUE *sinh, VALUE *cosh)
|
|
38
40
|
void
|
39
41
|
sinhcosh_ser(VALUE x, VALUE prec, VALUE *sinh, VALUE *cosh)
|
40
42
|
{
|
43
|
+
VALUE n;
|
41
44
|
int sign;
|
42
|
-
|
45
|
+
|
46
|
+
rb_check_precise(prec);
|
47
|
+
|
48
|
+
n = rb_numdiff_make_n(prec);
|
49
|
+
x = rb_num_canonicalize(x, n, ARG_REAL, ARG_RAWVALUE);
|
43
50
|
|
44
51
|
if (sinh == NULL && cosh == NULL) return;
|
45
52
|
|
@@ -63,7 +70,7 @@ sinhcosh_ser(VALUE x, VALUE prec, VALUE *sinh, VALUE *cosh)
|
|
63
70
|
}
|
64
71
|
else
|
65
72
|
{
|
66
|
-
sinhcosh_inline(x,
|
73
|
+
sinhcosh_inline(x, n, sinh, cosh);
|
67
74
|
if (sinh != NULL) *sinh = rb_num_round(*sinh, prec);
|
68
75
|
if (cosh != NULL) *cosh = rb_num_round(*cosh, prec);
|
69
76
|
}
|
@@ -2,7 +2,8 @@ VALUE
|
|
2
2
|
sqrt_branch(VALUE x, VALUE prec, bigmath_func1 sqrt_cb)
|
3
3
|
{
|
4
4
|
#define SWITCH_PRECISION_NUMBER 2253
|
5
|
-
|
5
|
+
x = rb_num_canonicalize(x, prec, ARG_REAL, ARG_RAWVALUE);
|
6
|
+
|
6
7
|
if (rb_num_negative_p(x))
|
7
8
|
return BIG_NAN;
|
8
9
|
else if (!rb_num_finite_p(x))
|
@@ -5,8 +5,8 @@ sqrt_builtin(VALUE x, VALUE prec)
|
|
5
5
|
|
6
6
|
rb_check_precise(prec);
|
7
7
|
|
8
|
-
if (rb_num_negative_p(x) ||
|
8
|
+
if (rb_num_negative_p(x) || rb_num_nan_p(x))
|
9
9
|
return BIG_NAN;
|
10
10
|
|
11
|
-
return rb_funcall(x, sqrt, 1, prec);
|
11
|
+
return rb_num_round(rb_funcall(x, sqrt, 1, prec), prec);
|
12
12
|
}
|
@@ -1,11 +1,13 @@
|
|
1
1
|
VALUE
|
2
2
|
tan_eulerf(VALUE z, VALUE prec)
|
3
3
|
{
|
4
|
-
VALUE w;
|
4
|
+
VALUE w, n;
|
5
5
|
|
6
6
|
rb_check_precise(prec);
|
7
|
+
n = rb_numdiff_make_n(prec);
|
7
8
|
|
8
|
-
w = trig_f_euler(mf_tan, rb_ImaginaryZ(z, SIGN_PLUS),
|
9
|
+
w = trig_f_euler(mf_tan, rb_ImaginaryZ(z, SIGN_PLUS), n);
|
10
|
+
w = rb_num_real(w);
|
9
11
|
|
10
|
-
return
|
12
|
+
return rb_num_round(w, prec);
|
11
13
|
}
|
@@ -2,17 +2,12 @@ VALUE
|
|
2
2
|
tan_ser(VALUE x, VALUE prec)
|
3
3
|
{
|
4
4
|
const ID div = rb_intern("div");
|
5
|
-
VALUE sin, cos;
|
5
|
+
VALUE sin, cos, n;
|
6
6
|
|
7
7
|
rb_check_precise(prec);
|
8
|
+
n = rb_numdiff_make_n(prec);
|
8
9
|
|
9
|
-
|
10
|
-
return BIG_NAN;
|
11
|
-
rb_check_precise(prec);
|
12
|
-
x = rb_num_canonicalize(x, prec, ARG_REAL, ARG_RAWVALUE);
|
13
|
-
rb_bigmath_sincos(x, prec, &sin, &cos);
|
14
|
-
sin = rb_num_round(sin, prec);
|
15
|
-
cos = rb_num_round(cos, prec);
|
10
|
+
rb_bigmath_sincos(x, n, &sin, &cos);
|
16
11
|
|
17
12
|
return rb_funcall(sin, div, 2, cos, prec);
|
18
13
|
}
|
@@ -1,11 +1,13 @@
|
|
1
1
|
VALUE
|
2
2
|
tanh_eulerf(VALUE x, VALUE prec)
|
3
3
|
{
|
4
|
-
VALUE y;
|
4
|
+
VALUE y = Qundef, n;
|
5
5
|
|
6
6
|
rb_check_precise(prec);
|
7
|
+
n = rb_numdiff_make_n(prec);
|
7
8
|
|
8
|
-
y = rb_ImaginaryZ(trig_f_euler(mf_tan, x,
|
9
|
+
y = rb_ImaginaryZ(trig_f_euler(mf_tan, x, n), SIGN_PLUS);
|
10
|
+
y = rb_num_real(y);
|
9
11
|
|
10
|
-
return
|
12
|
+
return rb_num_round(y, prec);
|
11
13
|
}
|
@@ -4,11 +4,15 @@ tanh_formula(VALUE x, VALUE prec)
|
|
4
4
|
const ID pred = rb_intern("pred");
|
5
5
|
const ID succ = rb_intern("succ");
|
6
6
|
const ID div = rb_intern("div");
|
7
|
-
VALUE n =
|
8
|
-
VALUE two = rb_BigDecimal1(INT2FIX(2));
|
9
|
-
VALUE t = rb_bigmath_exp(rb_funcall1(x, '*', two), n), y = Qundef;
|
7
|
+
VALUE n, two, t, y = Qundef;
|
10
8
|
int sign;
|
11
9
|
|
10
|
+
rb_check_precise(prec);
|
11
|
+
n = rb_numdiff_make_n(prec);
|
12
|
+
|
13
|
+
two = rb_BigDecimal1(INT2FIX(2));
|
14
|
+
t = rb_bigmath_exp(rb_funcall1(x, '*', two), n);
|
15
|
+
|
12
16
|
if (TYPE(t) == T_FIXNUM || TYPE(t) == T_BIGNUM)
|
13
17
|
{
|
14
18
|
y = rb_Rational(rb_funcall(t, pred, 0), rb_funcall(t, succ, 0));
|
@@ -1,13 +1,13 @@
|
|
1
1
|
VALUE
|
2
2
|
tanh_ser(VALUE x, VALUE prec)
|
3
3
|
{
|
4
|
-
VALUE y = Qundef, sinh = Qundef, cosh = Qundef;
|
4
|
+
VALUE y = Qundef, sinh = Qundef, cosh = Qundef, n;
|
5
5
|
const ID div = rb_intern("div");
|
6
6
|
|
7
7
|
rb_check_precise(prec);
|
8
|
+
n = rb_numdiff_make_n(prec);
|
8
9
|
|
9
|
-
sinhcosh_ser(x,
|
10
|
-
|
10
|
+
sinhcosh_ser(x, n, &sinh, &cosh);
|
11
11
|
y = rb_funcall(sinh, div, 2, cosh, prec);
|
12
12
|
|
13
13
|
return y;
|