Multi-Precision Arithmetic by C++ with no
use of assembler
SN library Copyright (C) 1999-2018 K.Tsuru
Reference of class functions part 12
14. Template classes of binary splitting method
The prototype declarations and implementations are given
in "sbstempl.h".
It provides a method to evaluate a series in a form
![]() |
where Ak, Bk
and Ck are integers.
1.template <class Tp> class BinarySplitting;
Constructor
form
BinarySplitting(long upto, long precision);
comment
upto : The L value in the above expression.
precision : The 1/4 of significant figures in a decimal system.
setABC
function A virtual function which sets coefficients Ak,
Bk and Ck.
form virtual void setABC(long k, Tp& a, Tp& b, Tp& c) = 0;
putTogether
function "x.putTogether();" sums up the series by a
recursive reduction, namely obtain A0
and C0.
form void putTogether();
getValue
function If "inv == true", "x.getValue(inv)" returns C0/A0, else
A0/C0.
form SDouble getValue(bool inv = false);
usage
See "sdcchpi.cpp".
2.template <class Tp> class BinarySplittingA1C;
In the case of Bk = 1, e.g. e - 1 = 1/1! + 1/2! + 1/3! + ....
usage
See "sdcbse.cpp".
3.template <class Tp> class BinarySplittingPoly;
In the case of Ck
= 1, e.g. SL = A0 +
A1B0 +
A2B0B1 + ...
It can be used to evaluate a polynomial of SLong or SInteger.
usage
See "sibscvbn.cpp"