Added by: ~guest, 2015 III 18

Added by: ~guest, 2015 III 18

typedef ttmath::Big<2, 2> big;

big max_double = std::numeric_limits<double>::max();

big a = max_double;

big b = 100.0;

big r = a + b;

//shouldn't r 100.0 bigger (not equal) then max_double?

assert(r > max_double);

Added by: tomek, 2015 III 18

The mantissa is too small, try:

std::cout << a << std::endl;

and you'll see:

1.79769313486231570814527423731704356798e+308

When you add a 100 the 'a' will not change. If you want to store a 308 decimal digits number you have to use a container which has at least: log(1.797 * 10 ^308; 2) = 1024 bits for the mantissa, e.g: typedef ttmath::Big<2, TTMATH_BITS(1100)> big;

Added by: ~guest, 2015 III 18

thanks for the fast reply AND the solution