bigdecimal-math_r 0.2.0
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 +7 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +13 -0
- data/changelog.md +24 -0
- data/ext/bigdecimal/math_r/algofunc.h +203 -0
- data/ext/bigdecimal/math_r/api/bigdecimal/check_precise.h +12 -0
- data/ext/bigdecimal/math_r/api/bigdecimal/infinity.h +6 -0
- data/ext/bigdecimal/math_r/api/bigdecimal/minus_infinity.h +5 -0
- data/ext/bigdecimal/math_r/api/bigdecimal/minus_one.h +6 -0
- data/ext/bigdecimal/math_r/api/bigdecimal/minus_zero.h +6 -0
- data/ext/bigdecimal/math_r/api/bigdecimal/nan.h +6 -0
- data/ext/bigdecimal/math_r/api/bigdecimal/one.h +6 -0
- data/ext/bigdecimal/math_r/api/bigdecimal/sign.h +10 -0
- data/ext/bigdecimal/math_r/api/bigdecimal/zero.h +6 -0
- data/ext/bigdecimal/math_r/api/bigmath/api_call1.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/api_call2.h +6 -0
- data/ext/bigdecimal/math_r/api/bigmath/atan.h +7 -0
- data/ext/bigdecimal/math_r/api/bigmath/atan_adopt.h +42 -0
- data/ext/bigdecimal/math_r/api/bigmath/cabs.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/carg.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/cexp.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/clog.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/const.h +39 -0
- data/ext/bigdecimal/math_r/api/bigmath/const_e.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/const_log10.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/const_log2.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/const_log_pi.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/const_pi.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/const_sqrt2.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/const_sqrt3.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/cpow.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/csqrt.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/degree_sparg.h +199 -0
- data/ext/bigdecimal/math_r/api/bigmath/escalb.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/exp.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/expxt.h +18 -0
- data/ext/bigdecimal/math_r/api/bigmath/hypot.h +10 -0
- data/ext/bigdecimal/math_r/api/bigmath/ipow.h +14 -0
- data/ext/bigdecimal/math_r/api/bigmath/l2norm.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/log.h +7 -0
- data/ext/bigdecimal/math_r/api/bigmath/pow.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/quadrant.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/sincos.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/sqrt.h +5 -0
- data/ext/bigdecimal/math_r/api/bigmath/to_rad.h +41 -0
- data/ext/bigdecimal/math_r/api/kernel/rb_BigDecimal.h +6 -0
- data/ext/bigdecimal/math_r/api/kernel/rb_BigDecimal1.h +6 -0
- data/ext/bigdecimal/math_r/api/kernel/rb_BigDecimal_flo.h +9 -0
- data/ext/bigdecimal/math_r/api/kernel/rb_ImaginaryZ.h +8 -0
- data/ext/bigdecimal/math_r/api/numanalysis/condition_p.h +26 -0
- data/ext/bigdecimal/math_r/api/numanalysis/make_n.h +9 -0
- data/ext/bigdecimal/math_r/api/numeric/abs.h +7 -0
- data/ext/bigdecimal/math_r/api/numeric/canonicalize.h +140 -0
- data/ext/bigdecimal/math_r/api/numeric/cmpeql.h +6 -0
- data/ext/bigdecimal/math_r/api/numeric/equal_p.h +6 -0
- data/ext/bigdecimal/math_r/api/numeric/finite_p.h +6 -0
- data/ext/bigdecimal/math_r/api/numeric/imag.h +6 -0
- data/ext/bigdecimal/math_r/api/numeric/infinite_p.h +7 -0
- data/ext/bigdecimal/math_r/api/numeric/nan_p.h +5 -0
- data/ext/bigdecimal/math_r/api/numeric/negative_p.h +6 -0
- data/ext/bigdecimal/math_r/api/numeric/nonzero_p.h +6 -0
- data/ext/bigdecimal/math_r/api/numeric/notequal_p.h +6 -0
- data/ext/bigdecimal/math_r/api/numeric/numeric_p.h +5 -0
- data/ext/bigdecimal/math_r/api/numeric/positive_p.h +6 -0
- data/ext/bigdecimal/math_r/api/numeric/real.h +6 -0
- data/ext/bigdecimal/math_r/api/numeric/real_p.h +6 -0
- data/ext/bigdecimal/math_r/api/numeric/round.h +56 -0
- data/ext/bigdecimal/math_r/api/numeric/uminus.h +6 -0
- data/ext/bigdecimal/math_r/api/numeric/zero_p.h +6 -0
- data/ext/bigdecimal/math_r/api.c +13 -0
- data/ext/bigdecimal/math_r/api.h +69 -0
- data/ext/bigdecimal/math_r/const.c +186 -0
- data/ext/bigdecimal/math_r/decl.h +203 -0
- data/ext/bigdecimal/math_r/edf.c +180 -0
- data/ext/bigdecimal/math_r/erf.c +80 -0
- data/ext/bigdecimal/math_r/euler_f.c +572 -0
- data/ext/bigdecimal/math_r/exp.c +72 -0
- data/ext/bigdecimal/math_r/extconf.rb +185 -0
- data/ext/bigdecimal/math_r/gamma_r.c +251 -0
- data/ext/bigdecimal/math_r/hyperb.c +172 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/E/ser.h +22 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/LOG10/ser.h +16 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/LOG2/BBP2002.h +36 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/LOG_PI/builtin.h +7 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/PI/machin.h +48 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/SQRT2/builtin.h +5 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/SQRT3/builtin.h +5 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acos/branch.h +25 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acos/edom.h +15 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acos/logrep.h +19 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acos/ser.h +34 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acosh/branch.h +19 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acosh/edom.h +17 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acosh/logrep.h +14 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acot/branch.h +16 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acot/logrep.h +13 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acoth/branch.h +20 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acoth/edom.h +18 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acoth/logrep.h +33 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acsc/branch.h +21 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acsc/edom.h +20 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acsc/logrep.h +16 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acsch/branch.h +25 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/acsch/logrep.h +25 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asec/branch.h +22 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asec/edom.h +16 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asec/logrep.h +21 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asech/branch.h +18 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asech/edom.h +19 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asech/logrep.h +16 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asin/branch.h +22 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asin/edom.h +20 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asin/logrep.h +15 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asin/ser.h +32 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asinh/branch.h +26 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asinh/logrep.h +24 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/asinh/ser.h +48 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atan/branch.h +16 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atan/logrep.h +14 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atan/ser_euler.h +84 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atan/ser_usual.h +41 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atanh/branch.h +24 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atanh/edom.h +16 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atanh/logrep.h +16 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/atanh/ser.h +33 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cabs/formula.h +8 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacos/branch.h +38 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacos/logrep.h +16 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacosh/branch.h +34 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacosh/logrep.h +17 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacot/branch.h +39 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacot/logrep.h +17 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacoth/branch.h +29 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacoth/logrep.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacsc/branch.h +28 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacsc/logrep.h +19 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacsch/branch.h +18 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cacsch/logrep.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/carg/formula.h +8 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/casec/branch.h +29 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/casec/logrep.h +18 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/casech/branch.h +38 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/casech/logrep.h +9 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/casin/branch.h +35 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/casin/logrep.h +14 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/casinh/branch.h +59 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/casinh/logrep.h +13 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/catan/branch.h +46 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/catan/logrep.h +17 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/catanh/branch.h +26 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/catanh/logrep.h +10 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccbrt/formula.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccos/branch.h +41 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccos/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccosh/branch.h +37 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccosh/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccot/branch.h +46 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccot/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccoth/branch.h +43 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccoth/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccsc/branch.h +42 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccsc/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccsch/branch.h +38 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ccsch/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cexp/branch.h +42 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cexp/eulerf.h +21 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cexp2/branch.h +42 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cexp2/eulerf.h +12 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/clog/branch.h +54 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/clog/formula.h +13 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/clog10/formula.h +12 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/clog1p/branch.h +34 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/clog2/formula.h +12 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cos/branch.h +21 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cos/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cos/ser.h +12 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cosh/branch.h +22 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cosh/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cosh/formula.h +30 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cosh/ser.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cot/branch.h +28 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cot/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cot/ser.h +12 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/coth/branch.h +23 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/coth/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/coth/formula.h +30 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/coth/ser.h +13 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cpow/formula.h +20 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csc/branch.h +28 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csc/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csc/ser.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csch/branch.h +23 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csch/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csch/formula.h +31 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csch/ser.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csec/branch.h +42 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csec/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csech/branch.h +38 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csech/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csin/branch.h +44 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csin/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csinh/branch.h +41 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csinh/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/csqrt/formula.h +66 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ctan/branch.h +46 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ctan/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ctanh/branch.h +43 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ctanh/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/cuberoot/newton.h +42 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erf/algo911.h +41 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erf/branch.h +18 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erf/cf.h +51 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erf/ser_inf.h +53 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erf/ser_zero.h +45 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erfc/algo911.h +27 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erfc/branch.h +18 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/erfc/cf.h +49 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/escalb/edf.h +87 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/exp/branch.h +29 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/exp/builtin.h +6 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/exp/edf.h +23 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/exp2/branch.h +29 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/exp2/edf.h +19 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/expxt/edf.h +31 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/f_euler/formula.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/hypot/branch.h +25 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/hypot/l2norm.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/hypot/mmm.h +38 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/ipow/edf.h +33 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/l2norm/formula.h +48 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log/branch.h +40 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log/builtin.h +12 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log/edf.h +10 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log/edom.h +10 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log/mercator.h +34 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log/ser_okumura.h +57 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log10/branch.h +40 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log10/edf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log10/mercator.h +35 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log1p/branch.h +34 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log1p/p_adic.h +37 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log1p/ser_mercator.h +35 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log2/branch.h +40 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log2/edf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/log2/mercator.h +35 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/logxt/edf.h +33 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/pow/formula.h +30 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/quadrant/formula.h +352 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/rcm10/edf.h +34 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/rcm2/edf.h +34 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sec/branch.h +27 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sec/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sec/ser.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sech/branch.h +21 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sech/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sech/formula.h +25 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sech/ser.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sin/branch.h +23 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sin/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sin/ser.h +13 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sincos/ser.h +50 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sinh/branch.h +23 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sinh/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sinh/formula.h +26 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sinh/ser.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sinhcosh/ser.h +70 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sqrt/branch.h +16 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sqrt/builtin.h +12 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sqrt/edom.h +9 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/sqrt/newton.h +36 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/tan/branch.h +26 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/tan/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/tan/ser.h +18 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/tanh/branch.h +23 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/tanh/eulerf.h +11 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/tanh/formula.h +27 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/tanh/ser.h +14 -0
- data/ext/bigdecimal/math_r/internal/algo/bigmath/trig/f_euler.h +290 -0
- data/ext/bigdecimal/math_r/log.c +256 -0
- data/ext/bigdecimal/math_r/logrep.c +537 -0
- data/ext/bigdecimal/math_r/math_r/bigdecimal.h +30 -0
- data/ext/bigdecimal/math_r/math_r/bigmath.h +61 -0
- data/ext/bigdecimal/math_r/math_r/bigmath_r.h +9 -0
- data/ext/bigdecimal/math_r/math_r/ext_extern.h +18 -0
- data/ext/bigdecimal/math_r/math_r/globals.h +71 -0
- data/ext/bigdecimal/math_r/math_r/numdiff.h +18 -0
- data/ext/bigdecimal/math_r/math_r/numeric.h +63 -0
- data/ext/bigdecimal/math_r/math_r.c +130 -0
- data/ext/bigdecimal/math_r/nucomp.c +158 -0
- data/ext/bigdecimal/math_r/overrides.c +91 -0
- data/ext/bigdecimal/math_r/power.c +207 -0
- data/ext/bigdecimal/math_r/solver.c +1516 -0
- data/ext/bigdecimal/math_r/trig.c +205 -0
- data/lib/bigdecimal/math_r/const/EulerGamma_engel.rb +46 -0
- data/lib/bigdecimal/math_r/const/LOG2_bbp2007.rb +39 -0
- data/lib/bigdecimal/math_r/const/PI_chudnovsky.rb +59 -0
- data/lib/bigdecimal/math_r/const/PI_euler.rb +40 -0
- data/lib/bigdecimal/math_r/const/PI_ramanujan1.rb +45 -0
- data/lib/bigdecimal/math_r/const/PI_ramanujan2.rb +46 -0
- data/lib/bigdecimal/math_r/const/b053977/b053977.txt +306 -0
- data/lib/bigdecimal/math_r/version.rb +7 -0
- data/lib/bigdecimal/math_r.rb +12 -0
- data/lib/bigdecimal/math_r.so +0 -0
- data/sig/bigdecimal/math_r.rbs +6 -0
- metadata +393 -0
@@ -0,0 +1,290 @@
|
|
1
|
+
static inline void
|
2
|
+
f_euler2(VALUE theta, VALUE prec, VALUE *exppz, VALUE *expmz)
|
3
|
+
{
|
4
|
+
const ID conj = rb_intern("conj");
|
5
|
+
*exppz = f_euler_formula(rb_num_imag(theta), prec);
|
6
|
+
*expmz = rb_funcall(*exppz, conj, 0);
|
7
|
+
}
|
8
|
+
|
9
|
+
|
10
|
+
static inline void
|
11
|
+
f_euler_e2(VALUE theta, VALUE prec, VALUE *exppz, VALUE *expmz)
|
12
|
+
{
|
13
|
+
const ID div = rb_intern("div");
|
14
|
+
VALUE r = rb_num_real(theta);
|
15
|
+
r = rb_num_canonicalize(r, prec, ARG_REAL, ARG_RAWVALUE);
|
16
|
+
r = rb_bigmath_exp(r, prec);
|
17
|
+
if (rb_num_notequal_p(r, r))
|
18
|
+
{
|
19
|
+
*exppz = BIG_NAN;
|
20
|
+
*expmz = BIG_NAN;
|
21
|
+
}
|
22
|
+
else if (TYPE(r) == T_FIXNUM || TYPE(r) == T_BIGNUM)
|
23
|
+
{
|
24
|
+
*exppz = rb_BigDecimal1(r);
|
25
|
+
r = rb_Rational(INT2FIX(1), r);
|
26
|
+
*expmz = rb_BigDecimal(r, prec);
|
27
|
+
}
|
28
|
+
else
|
29
|
+
{
|
30
|
+
*exppz = rb_BigDecimal1(r);
|
31
|
+
r = rb_funcall(BIG_ONE, div, 2, r, prec);
|
32
|
+
*expmz = rb_BigDecimal1(r);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
|
37
|
+
static inline VALUE
|
38
|
+
f_euler_cos(VALUE exppz, VALUE expmz)
|
39
|
+
{
|
40
|
+
VALUE y = rb_funcall1(exppz, '+', expmz);
|
41
|
+
y = rb_funcall1(y, '/', INT2FIX(2));
|
42
|
+
if (rb_num_real_p(y))
|
43
|
+
y = rb_Complex(y, BIG_ZERO);
|
44
|
+
return y;
|
45
|
+
}
|
46
|
+
|
47
|
+
static inline VALUE
|
48
|
+
f_euler_sin_infinite(VALUE y)
|
49
|
+
{
|
50
|
+
VALUE w = Qundef;
|
51
|
+
int real_sign, imag_sign;
|
52
|
+
real_sign = rb_num_infinite_p(rb_num_real(y));
|
53
|
+
imag_sign = rb_num_infinite_p(rb_num_imag(y));
|
54
|
+
if (real_sign == 1)
|
55
|
+
{
|
56
|
+
VALUE imag = rb_num_imag(y);
|
57
|
+
if (rb_num_zero_p(imag))
|
58
|
+
w = rb_Complex(BIG_ZERO, BIG_MINUS_INF);
|
59
|
+
else if (rb_num_positive_p(imag))
|
60
|
+
w = rb_Complex(BIG_MINUS_INF, BIG_INF);
|
61
|
+
else if (rb_num_negative_p(imag))
|
62
|
+
w = rb_Complex(BIG_INF, BIG_INF);
|
63
|
+
}
|
64
|
+
else if (real_sign == -1)
|
65
|
+
{
|
66
|
+
VALUE imag = rb_num_imag(y);
|
67
|
+
if (rb_num_zero_p(imag))
|
68
|
+
w = rb_Complex(BIG_ZERO, BIG_INF);
|
69
|
+
else if (rb_num_positive_p(imag))
|
70
|
+
w = rb_Complex(BIG_INF, BIG_INF);
|
71
|
+
else if (rb_num_negative_p(imag))
|
72
|
+
w = rb_Complex(BIG_MINUS_INF, BIG_INF);
|
73
|
+
}
|
74
|
+
else if (imag_sign == 1)
|
75
|
+
{
|
76
|
+
VALUE real = rb_num_real(y);
|
77
|
+
if (rb_num_zero_p(real))
|
78
|
+
w = rb_Complex(BIG_INF, BIG_ZERO);
|
79
|
+
else if (rb_num_positive_p(real))
|
80
|
+
w = rb_Complex(BIG_MINUS_INF, BIG_INF);
|
81
|
+
else if (rb_num_negative_p(real))
|
82
|
+
w = rb_Complex(BIG_INF, BIG_INF);
|
83
|
+
}
|
84
|
+
else if (imag_sign == -1)
|
85
|
+
{
|
86
|
+
VALUE real = rb_num_real(y);
|
87
|
+
if (rb_num_zero_p(real))
|
88
|
+
w = rb_Complex(BIG_MINUS_INF, BIG_ZERO);
|
89
|
+
else if (rb_num_positive_p(real))
|
90
|
+
w = rb_Complex(BIG_MINUS_INF, BIG_MINUS_INF);
|
91
|
+
else if (rb_num_negative_p(real))
|
92
|
+
w = rb_Complex(BIG_MINUS_INF, BIG_INF);
|
93
|
+
}
|
94
|
+
|
95
|
+
if (w == Qundef)
|
96
|
+
rb_raise(rb_eRuntimeError, "no solution (in f_euler_sin_infinite())");
|
97
|
+
return w;
|
98
|
+
}
|
99
|
+
|
100
|
+
static inline VALUE
|
101
|
+
f_euler_sin(VALUE exppz, VALUE expmz)
|
102
|
+
{
|
103
|
+
VALUE y = rb_funcall1(exppz, '-', expmz);
|
104
|
+
VALUE two_i = rb_Complex(BIG_ZERO, rb_BigDecimal1(INT2FIX(2)));
|
105
|
+
// BUG: In the current version 3.3.5
|
106
|
+
// -Float::INFINITY / 2i #=> (NaN+Infinity*i)
|
107
|
+
// Correct: (0.0+Infinity*i)
|
108
|
+
if (!rb_num_finite_p(y))
|
109
|
+
y = f_euler_sin_infinite(y);
|
110
|
+
else
|
111
|
+
y = rb_funcall1(y, '/', two_i);
|
112
|
+
return y;
|
113
|
+
}
|
114
|
+
|
115
|
+
static inline VALUE
|
116
|
+
f_euler_tan(VALUE exppz, VALUE expmz)
|
117
|
+
{
|
118
|
+
VALUE sin, cos;
|
119
|
+
|
120
|
+
if (rb_num_zero_p(exppz))
|
121
|
+
return rb_Complex(BIG_ZERO, BIG_ONE);
|
122
|
+
else if (rb_num_infinite_p(exppz))
|
123
|
+
return rb_Complex(BIG_ZERO, BIG_MINUS_ONE);
|
124
|
+
/* else */
|
125
|
+
sin = rb_funcall1(expmz, '-', exppz);
|
126
|
+
sin = rb_ImaginaryZ(sin, SIGN_PLUS);
|
127
|
+
cos = rb_funcall1(expmz, '+', exppz);
|
128
|
+
return rb_funcall1(sin, '/', cos);
|
129
|
+
}
|
130
|
+
|
131
|
+
static inline VALUE
|
132
|
+
f_euler_sc(const ID func, VALUE theta, VALUE prec)
|
133
|
+
{
|
134
|
+
VALUE exppz = Qundef, expmz = Qundef, y = Qundef;
|
135
|
+
|
136
|
+
if (!rb_num_finite_p(rb_num_imag(theta)))
|
137
|
+
return rb_Complex(BIG_NAN, BIG_NAN);
|
138
|
+
|
139
|
+
f_euler2(theta, prec, &exppz, &expmz);
|
140
|
+
|
141
|
+
if (func == mf_cos)
|
142
|
+
{
|
143
|
+
y = f_euler_cos(exppz, expmz);
|
144
|
+
}
|
145
|
+
else if (func == mf_sin)
|
146
|
+
{
|
147
|
+
y = f_euler_sin(exppz, expmz);
|
148
|
+
}
|
149
|
+
else if (func == mf_tan)
|
150
|
+
{
|
151
|
+
y = f_euler_tan(exppz, expmz);
|
152
|
+
}
|
153
|
+
return rb_num_round(y, prec);
|
154
|
+
}
|
155
|
+
|
156
|
+
// For real of tangent's exponent, tanh(x), coth(x) or tan(i x) or cot(i x)
|
157
|
+
static inline VALUE
|
158
|
+
f_euler_t(VALUE theta, VALUE prec)
|
159
|
+
{
|
160
|
+
const ID div = rb_intern("div");
|
161
|
+
const ID sub = rb_intern("sub");
|
162
|
+
const ID add = rb_intern("add");
|
163
|
+
const ID pred = rb_intern("pred");
|
164
|
+
const ID succ = rb_intern("succ");
|
165
|
+
VALUE y = Qundef;
|
166
|
+
theta = rb_num_real(theta);
|
167
|
+
theta = rb_num_canonicalize(theta, prec, ARG_REAL, ARG_RAWVALUE);
|
168
|
+
if (!rb_num_finite_p(theta))
|
169
|
+
{
|
170
|
+
switch (NUM2INT(rb_BigDecimal_sign(theta))) {
|
171
|
+
case 0:
|
172
|
+
y = BIG_NAN;
|
173
|
+
break;
|
174
|
+
case 3:
|
175
|
+
y = BIG_ONE;
|
176
|
+
break;
|
177
|
+
case -3:
|
178
|
+
y = BIG_MINUS_ONE;
|
179
|
+
break;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
else
|
183
|
+
{
|
184
|
+
y = rb_bigmath_exp(rb_funcall(INT2FIX(2), '*', 1, rb_num_real(theta)), prec);
|
185
|
+
if (CLASS_OF(y) == rb_cBigDecimal)
|
186
|
+
{
|
187
|
+
if (rb_num_finite_p(y))
|
188
|
+
y = rb_funcall(
|
189
|
+
rb_funcall(y, sub, 2, INT2FIX(1), prec), div, 2,
|
190
|
+
rb_funcall(y, add, 2, INT2FIX(1), prec), prec
|
191
|
+
);
|
192
|
+
else if (rb_num_infinite_p(y))
|
193
|
+
y = BIG_ONE;
|
194
|
+
}
|
195
|
+
else if (TYPE(y) == T_FIXNUM || TYPE(y) == T_BIGNUM)
|
196
|
+
{
|
197
|
+
y = rb_BigDecimal(
|
198
|
+
rb_Rational(
|
199
|
+
rb_funcall(y, pred, 0),
|
200
|
+
rb_funcall(y, succ, 0)
|
201
|
+
), prec);
|
202
|
+
}
|
203
|
+
else
|
204
|
+
y = BIG_ONE;
|
205
|
+
}
|
206
|
+
if (y == Qundef)
|
207
|
+
rb_raise(rb_eRuntimeError, "no solution");
|
208
|
+
return rb_ImaginaryZ(y, SIGN_MINUS);
|
209
|
+
}
|
210
|
+
|
211
|
+
|
212
|
+
static inline VALUE
|
213
|
+
f_euler_h(const ID func, VALUE theta, VALUE prec)
|
214
|
+
{
|
215
|
+
VALUE y = Qundef, exppz = Qundef, expmz = Qundef;
|
216
|
+
|
217
|
+
if (func == mf_tan)
|
218
|
+
return f_euler_t(theta, prec);
|
219
|
+
|
220
|
+
f_euler_e2(rb_num_real(theta), prec, &exppz, &expmz);
|
221
|
+
|
222
|
+
if (func == mf_cos)
|
223
|
+
{
|
224
|
+
y = f_euler_cos(exppz, expmz);
|
225
|
+
}
|
226
|
+
else if (func == mf_sin)
|
227
|
+
{
|
228
|
+
y = f_euler_sin(exppz, expmz);
|
229
|
+
}
|
230
|
+
return rb_num_round(y, prec);
|
231
|
+
}
|
232
|
+
|
233
|
+
static inline VALUE
|
234
|
+
f_euler_esc(const ID func, VALUE z, VALUE prec)
|
235
|
+
{
|
236
|
+
VALUE e_exppz = Qundef,
|
237
|
+
e_expmz = Qundef,
|
238
|
+
sc_exppz = Qundef,
|
239
|
+
sc_expmz = Qundef,
|
240
|
+
exppz = Qundef,
|
241
|
+
expmz = Qundef,
|
242
|
+
y = Qundef;
|
243
|
+
f_euler_e2(z, prec, &e_exppz, &e_expmz);
|
244
|
+
f_euler2(z, prec, &sc_exppz, &sc_expmz);
|
245
|
+
exppz = rb_funcall1(e_exppz, '*', sc_exppz);
|
246
|
+
expmz = rb_funcall1(e_expmz, '*', sc_expmz);
|
247
|
+
|
248
|
+
if (func == mf_cos)
|
249
|
+
{
|
250
|
+
y = f_euler_cos(exppz, expmz);
|
251
|
+
}
|
252
|
+
else if (func == mf_sin)
|
253
|
+
{
|
254
|
+
y = f_euler_sin(exppz, expmz);
|
255
|
+
}
|
256
|
+
else if (func == mf_tan)
|
257
|
+
{
|
258
|
+
y = f_euler_tan(exppz, expmz);
|
259
|
+
}
|
260
|
+
return rb_num_round(y, prec);
|
261
|
+
}
|
262
|
+
|
263
|
+
VALUE
|
264
|
+
trig_f_euler(const ID func, VALUE theta, VALUE prec)
|
265
|
+
{
|
266
|
+
VALUE h = Qundef, sc = Qundef;
|
267
|
+
if (rb_num_nan_p(theta))
|
268
|
+
return rb_Complex(BIG_NAN, BIG_NAN);
|
269
|
+
if (rb_num_zero_p(rb_num_imag(theta)))
|
270
|
+
{
|
271
|
+
h = f_euler_h(func, theta, prec);
|
272
|
+
if (rb_num_nan_p(h))
|
273
|
+
return h;
|
274
|
+
}
|
275
|
+
if (rb_num_zero_p(rb_num_real(theta)))
|
276
|
+
{
|
277
|
+
sc = f_euler_sc(func, theta, prec);
|
278
|
+
if (rb_num_nan_p(sc))
|
279
|
+
return sc;
|
280
|
+
}
|
281
|
+
if (h != Qundef && sc == Qundef)
|
282
|
+
return h;
|
283
|
+
else if (h == Qundef && sc != Qundef)
|
284
|
+
return sc;
|
285
|
+
else
|
286
|
+
{
|
287
|
+
VALUE y = f_euler_esc(func, theta, prec);
|
288
|
+
return y;
|
289
|
+
}
|
290
|
+
}
|
@@ -0,0 +1,256 @@
|
|
1
|
+
/*******************************************************************************
|
2
|
+
log.c -- Logarithm
|
3
|
+
|
4
|
+
Author: tribusonz
|
5
|
+
Licence: MIT
|
6
|
+
*******************************************************************************/
|
7
|
+
#include <ruby.h>
|
8
|
+
#include "math_r/globals.h"
|
9
|
+
#include "math_r/bigmath_r.h"
|
10
|
+
#include "decl.h"
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Computes natural logarithm of +x + 1+ by mercator series expansion.
|
14
|
+
*
|
15
|
+
* @example
|
16
|
+
* BigMathR::Log.log1p_ser_mercator(1, 20)
|
17
|
+
* #=> 0.69314718055994530942e0
|
18
|
+
* @param x [Numeric] Numerical argument
|
19
|
+
* @param prec [Integer] Arbitrary precision
|
20
|
+
* @return [Complex] Real precision
|
21
|
+
* @raise [TypeError] +prec+ is not an Integer
|
22
|
+
* @raise [RangeError] +prec+ is zero or negative number
|
23
|
+
* @since 0.1.0
|
24
|
+
*/
|
25
|
+
static VALUE
|
26
|
+
__impl_log1p_ser_mercator(VALUE uunused_obj, VALUE x, VALUE prec)
|
27
|
+
{
|
28
|
+
const ID cover_p = rb_intern("cover?");
|
29
|
+
VALUE domain = rb_range_new(INT2FIX(-1), INT2FIX(1), false);
|
30
|
+
if (RTEST(rb_funcall(domain, cover_p, 1, x)))
|
31
|
+
{
|
32
|
+
if (rb_num_equal_p(x, INT2FIX(-1)))
|
33
|
+
return BIG_MINUS_INF;
|
34
|
+
else if (rb_num_equal_p(x, INT2FIX(1)))
|
35
|
+
return rb_bigmath_const_log2(prec);
|
36
|
+
else
|
37
|
+
return log1p_ser_mercator(x, prec);
|
38
|
+
}
|
39
|
+
else
|
40
|
+
return BIG_NAN;
|
41
|
+
}
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Computes p-adic logarithm of +x+.
|
45
|
+
*
|
46
|
+
* @example
|
47
|
+
* BigMathR::Log.log1p_p_adic(1, 20)
|
48
|
+
* #=> 0.69314718055994530942e0
|
49
|
+
* @param x [Numeric] Numerical argument
|
50
|
+
* @param prec [Integer] Arbitrary precision
|
51
|
+
* @return [Complex] Real precision
|
52
|
+
* @raise [TypeError] +prec+ is not an Integer
|
53
|
+
* @raise [RangeError] +prec+ is zero or negative number
|
54
|
+
* @since 0.1.0
|
55
|
+
*/
|
56
|
+
static VALUE
|
57
|
+
__impl_log1p_p_adic(VALUE uunused_obj, VALUE x, VALUE prec)
|
58
|
+
{
|
59
|
+
const ID cover_p = rb_intern("cover?");
|
60
|
+
VALUE domain = rb_range_new(INT2FIX(-1), INT2FIX(1), false);
|
61
|
+
if (RTEST(rb_funcall(domain, cover_p, 1, x)))
|
62
|
+
{
|
63
|
+
if (rb_num_equal_p(x, INT2FIX(-1)))
|
64
|
+
return BIG_MINUS_INF;
|
65
|
+
else if (rb_num_equal_p(x, INT2FIX(1)))
|
66
|
+
return rb_bigmath_const_log2(prec);
|
67
|
+
else
|
68
|
+
return log1p_p_adic(x, prec);
|
69
|
+
}
|
70
|
+
else
|
71
|
+
return BIG_NAN;
|
72
|
+
}
|
73
|
+
|
74
|
+
/**
|
75
|
+
* Computes natural logarithm of +x+ by builtin function.
|
76
|
+
* <br>
|
77
|
+
* @example
|
78
|
+
* BigMathR::Log.log_builtin(2, 20)
|
79
|
+
* #=> 0.69314718055994530942e0
|
80
|
+
* @param x [Numeric] Numerical argument
|
81
|
+
* @param prec [Integer] Arbitrary precision
|
82
|
+
* @return [BigDecimal] Real solution
|
83
|
+
* @raise [TypeError] +prec+ is not an Integer
|
84
|
+
* @raise [RangeError] +prec+ is zero or negative number
|
85
|
+
* @since 0.1.0
|
86
|
+
*/
|
87
|
+
static VALUE
|
88
|
+
__impl_log_builtin(VALUE uunused_obj, VALUE x, VALUE prec)
|
89
|
+
{
|
90
|
+
return log_branch(x, prec, log_builtin);
|
91
|
+
}
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Computes natural logarithm of +x+ by series expansion.
|
95
|
+
* <br>
|
96
|
+
* @example
|
97
|
+
* BigMathR::Log.log_ser_okumura(2, 20)
|
98
|
+
* #=> 0.69314718055994530942e0
|
99
|
+
* @param x [Numeric] Numerical argument
|
100
|
+
* @param prec [Integer] Arbitrary precision
|
101
|
+
* @return [BigDecimal] Real solution
|
102
|
+
* @raise [TypeError] +prec+ is not an Integer
|
103
|
+
* @raise [RangeError] +prec+ is zero or negative number
|
104
|
+
* @since 0.1.0
|
105
|
+
*/
|
106
|
+
static VALUE
|
107
|
+
__impl_log_ser_okumura(VALUE uunused_obj, VALUE x, VALUE prec)
|
108
|
+
{
|
109
|
+
return log_branch(x, prec, log_ser_okumura);
|
110
|
+
}
|
111
|
+
|
112
|
+
/**
|
113
|
+
* Computes natural logarithm of +x+.
|
114
|
+
* <br>
|
115
|
+
* In terms of solving real number solutions, the implementation is the same as log() in C.
|
116
|
+
*
|
117
|
+
* @example
|
118
|
+
* BigMathR::EDF.log(2, 20) #=> 0.69314718055994530942e0
|
119
|
+
* @param x [Numeric] Numerical argument
|
120
|
+
* @param prec [Integer] Arbitrary precision
|
121
|
+
* @return [BigDecimal] Real solution
|
122
|
+
* @raise [TypeError] +prec+ is not an Integer
|
123
|
+
* @raise [RangeError] +prec+ is zero or negative number
|
124
|
+
*/
|
125
|
+
static VALUE
|
126
|
+
__impl_log_edf(VALUE unused_obj, VALUE x, VALUE prec)
|
127
|
+
{
|
128
|
+
return log_branch(x, prec, log_edf);
|
129
|
+
}
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Computes binary logarithm of +x+.
|
133
|
+
* <br>
|
134
|
+
* In terms of solving real number solutions, the implementation is the same as log2() in C.
|
135
|
+
*
|
136
|
+
* @example
|
137
|
+
* BigMathR::EDF.log2(2, 20) #=> 0.1e1
|
138
|
+
* @param x [Numeric] Numerical argument
|
139
|
+
* @param prec [Integer] Arbitrary precision
|
140
|
+
* @return [BigDecimal] Real solution
|
141
|
+
* @raise [TypeError] +prec+ is not an Integer
|
142
|
+
* @raise [RangeError] +prec+ is zero or negative number
|
143
|
+
*/
|
144
|
+
static VALUE
|
145
|
+
__impl_log2_edf(VALUE unused_obj, VALUE x, VALUE prec)
|
146
|
+
{
|
147
|
+
return log2_branch(x, prec, log2_edf);
|
148
|
+
}
|
149
|
+
|
150
|
+
/**
|
151
|
+
* Computes common logarithm of +x+.
|
152
|
+
* <br>
|
153
|
+
* In terms of solving real number solutions, the implementation is the same as log10() in C.
|
154
|
+
*
|
155
|
+
* @example
|
156
|
+
* BigMathR::EDF.log10(2, 30) #=> 0.301029995663981195213738894724e0
|
157
|
+
* @param x [Numeric] Numerical argument
|
158
|
+
* @param prec [Integer] Arbitrary precision
|
159
|
+
* @return [BigDecimal] Real solution
|
160
|
+
* @raise [TypeError] +prec+ is not an Integer
|
161
|
+
* @raise [RangeError] +prec+ is zero or negative number
|
162
|
+
*/
|
163
|
+
static VALUE
|
164
|
+
__impl_log10_edf(VALUE unused_obj, VALUE x, VALUE prec)
|
165
|
+
{
|
166
|
+
return log10_branch(x, prec, log10_edf);
|
167
|
+
}
|
168
|
+
|
169
|
+
/**
|
170
|
+
* Computes complex natural logarithm of +z+.
|
171
|
+
*
|
172
|
+
* @example
|
173
|
+
* BigMathR::LogSqrt.clog(1+1i, 20)
|
174
|
+
* #=> (0.34657359027997265471e0+0.78539816339744830963e0i)
|
175
|
+
* @param z [Numeric] Numerical argument
|
176
|
+
* @param prec [Integer] Arbitrary precision
|
177
|
+
* @return [Complex] Complex solution
|
178
|
+
* @raise [TypeError] +prec+ is not an Integer
|
179
|
+
* @raise [RangeError] +prec+ is zero or negative number
|
180
|
+
* @since 0.1.0
|
181
|
+
*/
|
182
|
+
static VALUE
|
183
|
+
__impl_clog_formula(VALUE unused_obj, VALUE z, VALUE prec)
|
184
|
+
{
|
185
|
+
return clog_branch(z, prec, clog_formula);
|
186
|
+
}
|
187
|
+
|
188
|
+
/**
|
189
|
+
* Computes complex binary logarithm of +z+.
|
190
|
+
*
|
191
|
+
* @example
|
192
|
+
* BigMathR::LogSqrt.clog2(1+1i, 20)
|
193
|
+
* #=> (0.5e0+0.11330900354567984524e1i)
|
194
|
+
* @param z [Numeric] Numerical argument
|
195
|
+
* @param prec [Integer] Arbitrary precision
|
196
|
+
* @return [Complex] Complex solution
|
197
|
+
* @raise [TypeError] +prec+ is not an Integer
|
198
|
+
* @raise [RangeError] +prec+ is zero or negative number
|
199
|
+
* @since 0.1.0
|
200
|
+
*/
|
201
|
+
static VALUE
|
202
|
+
__impl_clog2_formula(VALUE unused_obj, VALUE z, VALUE prec)
|
203
|
+
{
|
204
|
+
return clog_branch(z, prec, clog2_formula);
|
205
|
+
}
|
206
|
+
|
207
|
+
/**
|
208
|
+
* Computes complex common logarithm of +z+.
|
209
|
+
*
|
210
|
+
* @example
|
211
|
+
* BigMathR::LogSqrt.clog10(1+1i, 20)
|
212
|
+
* #=> (0.15051499783199059761e0+0.34109408846046033688e0i)
|
213
|
+
* @param z [Numeric] Numerical argument
|
214
|
+
* @param prec [Integer] Arbitrary precision
|
215
|
+
* @return [Complex] Complex solution
|
216
|
+
* @raise [TypeError] +prec+ is not an Integer
|
217
|
+
* @raise [RangeError] +prec+ is zero or negative number
|
218
|
+
* @since 0.1.0
|
219
|
+
*/
|
220
|
+
static VALUE
|
221
|
+
__impl_clog10_formula(VALUE unused_obj, VALUE z, VALUE prec)
|
222
|
+
{
|
223
|
+
return clog_branch(z, prec, clog10_formula);
|
224
|
+
}
|
225
|
+
|
226
|
+
|
227
|
+
/**
|
228
|
+
* Document-module: BigMathR::Logarithm
|
229
|
+
*
|
230
|
+
* A module that treats the logarithm algorithm.
|
231
|
+
* It is used internally.
|
232
|
+
* <br>
|
233
|
+
* == Synopsis
|
234
|
+
* The function names defined are the same as those in the C/C++ standard.
|
235
|
+
* <br>
|
236
|
+
* - Natural logarithm: +:clog+ <br>
|
237
|
+
* - Binary logarithm: +:clog2+ <br>
|
238
|
+
* - Common logarithm: +:clog10+ <br>
|
239
|
+
*/
|
240
|
+
void
|
241
|
+
InitVM_Log(void)
|
242
|
+
{
|
243
|
+
rb_define_module_function(rb_mLog, "log_builtin", __impl_log_builtin, 2);
|
244
|
+
rb_define_module_function(rb_mLog, "log_ser_okumura", __impl_log_ser_okumura, 2);
|
245
|
+
|
246
|
+
rb_define_module_function(rb_mEDF, "log_edf", __impl_log_edf, 2);
|
247
|
+
rb_define_module_function(rb_mEDF, "log2_edf", __impl_log2_edf, 2);
|
248
|
+
rb_define_module_function(rb_mEDF, "log10_edf", __impl_log10_edf, 2);
|
249
|
+
|
250
|
+
rb_define_module_function(rb_mLog, "log1p_ser_mercator", __impl_log1p_ser_mercator, 2);
|
251
|
+
rb_define_module_function(rb_mLog, "log1p_p_adic", __impl_log1p_p_adic, 2);
|
252
|
+
|
253
|
+
rb_define_module_function(rb_mLog, "clog_formula", __impl_clog_formula, 2);
|
254
|
+
rb_define_module_function(rb_mLog, "clog2_formula", __impl_clog2_formula, 2);
|
255
|
+
rb_define_module_function(rb_mLog, "clog10_formula", __impl_clog10_formula, 2);
|
256
|
+
}
|