Samples

Added by: tomek, 2008 V 02, Last modified: 2009 XI 27

The first listing presents how to use ttmath::UInt<>. It creates three objects with 2 words each. On 32bit
platform the max value which can be held is 2^(32*2)-1. Notice that we can initialise variables with string or
if the value is small by using standard 'unsigned int' type.

The second listing shows the ttmath::Int<> type. It is an integer type with a sign. The highest bit in the
value tells us about the sign, if it is set the value is negative. The format of keeping values is the same as
standard int type etc (two's complement). Values in this example can be from -2^(32*2-1) to 2^(32*2-1)-1 (on 32bit
platform)

Standard manipulators such as std::setprecision(...) or std::setbase(...) etc are not supported at the moment.
If you want to print a value in a different format use ttmath::Big<>::ToString(...) method instead.

With the library also goes a mathematical parser (listing nr 4). How does it work you can see on this website,
the
big online calculator
uses it.