:

conversion back to double

Added by: ~guest, 2010 VI 02

Added by: ~guest, 2010 VI 02

There's no problem converting double to high precision. After performing my calculations I need to convert the result back to double. The final result is a big messy array with thousands of doubles. The high precision is only needed for one particular type of calculation. For example:

typedef ttmath::Big<TTMATH_BITS(32), TTMATH_BITS(128)> MyBig;
...
MyBig tta = "0.0356346";
MyBig ttb = "10.3456";
MyBig ttresult;
double result;

ttresult.LN(tta);
ttresult = ttresult * ttb;

result = double(ttresult);
// OK, this is obviously not going to work

Any slick way to convert back to double short of messing around with expo & mantissa?

Added by: tomek, 2010 VI 02

You can use Big::ToDouble(double & out)

double result;
ttresult.ToDouble(result)