added: to samples: big2.cpp with TTMATH_BITS() macro

git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@285 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-02-07 13:36:39 +00:00
parent 35f2a8a28b
commit 053861655d
3 changed files with 129 additions and 8 deletions

View File

@@ -5,8 +5,10 @@
// this type has 2 words for its mantissa and 1 word for its exponent
// (on a 32bit platform one word means a word of 32 bits,
// and on a 64bit platform one word means a word of 64 bits)
// Big<exponent, mantissa>
typedef ttmath::Big<1,2> MyBig;
void SimpleCalculating(const MyBig & a, const MyBig & b)
{
@@ -56,6 +58,7 @@ MyBig atemp;
}
int main()
{
MyBig a,b;
@@ -86,12 +89,12 @@ b = 98767878.124322
a + b = 98891334.667778
a - b = -98644421.580866
a * b = 12193540837712.2708
a / b = 0.0012499665458095765
a / b = 0.00124996654580957646
Calculating with a carry
a = 1.624801256070839555e+646457012
b = 456.31999999999999
a + b = 1.624801256070839555e+646457012
a - b = 1.624801256070839555e+646457012
a = 1.624801256066640878e+646457012
b = 456.319999999999993
a + b = 1.624801256066640878e+646457012
a - b = 1.624801256066640878e+646457012
a * b = (carry)
a / b = 3.56066193914542334e+646457009
a / b = 3.560661939136222174e+646457009
*/