Using sqrt() with a Complex Equation.

Added by: ~Goldn3agle , 2015 IX 17

Hello, I've recently downloaded the ttmath library because I need a floating point number with a magnitude of over 15 digits.

So far I've had success using the ttmath::Big<> data but I've hit a roadblock with the equation, which is as follows:

L=L0*sqrt(1-pow(v, 2.0)/pow(c, 2.0));

But when I compile the solution the error: "[Error] cannot convert 'ttmath::Big<1u, 2u>' to 'double' for argument '1' to 'double pow(double, double)'"

Is displayed, and I have narrowed it down to the square root function (as I tried replacing the POW() with ^ and the same error is produced.

Added by: tomek, 2015 IX 17

Hi, try this one:

typedef ttmath::Big<1, TTMATH_BITS(512)> big;
int main()
{
big L, v, L0, c, one, two;

L0 = 100;
v = 200;
c = 300;
one = 1.0;
two = 2.0;

v.Pow(two);
c.Pow(two);

L=L0 * ttmath::Sqrt(one - v/c);

std::cout << L << std::endl;
}