added: 'constgen' directory -- there is a program there to generate some constants used in ttmathbig.h

changed: the size of built-in variables (constants) in ttmathbig.h
         now they consist of 256 32bit words
         macro TTMATH_BUILTIN_VARIABLES_SIZE is equal: 256u on a 32bit platform and 128ul on a 64bit platform
added:   macro CONSTANTSGENERATOR which is useful for generating constants
         (it's used by 'gen' program in 'constgen' directory)
         after declaring this macro the methods: ExpSurrounding0() and LnSurrounding1() will be public visible
         and the inner loop can do more iterations than TTMATH_ARITHMETIC_MAX_LOOP
changed: in methods: ExpSurrounding0() and LnSurrounding1() - the way of comparising with the last word
         (now we're comparing not with the last state but with a state from a few words back)



git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@105 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2009-03-12 20:54:46 +00:00
parent 978815f12d
commit 460608859c
12 changed files with 322 additions and 133 deletions

View File

@@ -32,20 +32,21 @@ MyBig atemp;
if( !atemp.Add(b) )
std::cout << "a + b = " << atemp << std::endl;
else
std::cout << "a + b = (carry) " << atemp << std::endl;
std::cout << "a + b = (carry)" << std::endl;
// it have no sense to print 'atemp' (it's undefined)
atemp = a;
if( !atemp.Sub(b) )
std::cout << "a - b = " << atemp << std::endl;
else
std::cout << "a - b = (carry) " << atemp << std::endl;
std::cout << "a - b = (carry)" << std::endl;
atemp = a;
if( !atemp.Mul(b) )
std::cout << "a * b = " << atemp << std::endl;
else
std::cout << "a * b = (carry: the result is too big) " << std::endl;
// it have no sense to print 'atemp' (it's undefined)
std::cout << "a * b = (carry)" << std::endl;
atemp = a;
if( !atemp.Div(b) )
@@ -68,9 +69,8 @@ MyBig a,b;
// 'a' will have the max value which can be held in this type
a.SetMax();
// at the moment conversions from double (or float etc.) are not supported
// you cannot do that: b = 456.32f
b = "456.32";
// conversion from double
b = 456.32;
// Look at the value 'a' and the product from a+b and a-b
// Don't worry this is the nature of floating point numbers
@@ -89,9 +89,9 @@ a * b = 12193540837712.2708
a / b = 0.0012499665458095765
Calculating with a carry
a = 1.624801256070839555e+646457012
b = 456.32
b = 456.31999999999999
a + b = 1.624801256070839555e+646457012
a - b = 1.624801256070839555e+646457012
a * b = (carry: the result is too big)
a / b = 3.56066193914542329e+646457009
a * b = (carry)
a / b = 3.56066193914542334e+646457009
*/