Multi-Precision Arithmetic by C++ with no use of assembler
SN library Copyright (C) 1999-2007 K.Tsuru

Addendum


1. Note on the usage of constructor of SDecimal class
In order to restore the value of "cutDown"(SNmuber class's private member) you must write such as

    SDouble Func(const SDouble& x){
        SDecimal y;   // "pushCD" saves the value of "cutDown" entering this function.
        y = Bfunc(x); // SDecimal function, substitution operator is used.
        return y.ConvToDec();
    }
If you write
    SDecimal y = Bfunc(x); // copy constructor is used, not substitution operator.
the right hand side is firstly evaluated and the value "cutDown" of temporal SDecimal object is saved. Returning to the called function the operation mode cannot be correctly restored.

2.Note on the mixed operation between SLong and SDouble variables
If you write such as
    SLong one(1);
    SDouble d;
    d=0.1+one;
in the evaluation of right hand side the operation "SLong+SLong" is applied and 'd' has a value "1" not "1.1".
Please use the cast operator such as
    d=0.1+(SDouble)one;
In other mixed operations it is the same.

3.About increment and decrement operators
On the Turbo C++ Ver. 4.0J when you write such as
    SLong a(10);
    a++++; //add four +'s
no error occurs. See the book "More Effective C++"(S. Meyers. Addison-Wesley Pub.Co.Inc., 1966).

4.About overhead due to copy
The processing time spent by the copy of memory e.g. copy constructor is a few percent of the whole. Then it seems that it is no use to try make a program faster by improving those parts.