I'm trying to have C++ solve an equation I have set up.
The equation is:
angle = (1/16)*(pow(LS,2) + LS*sqrt(pow(LS,2) + pow(16,2) - 1) - 1);
where LS is a number from -1 to 1 by increasing it by 0.0001
I have angle and LS defined as double, when I run this program it tells me that the angle is equal to -1, -0, or 0 no matter what LS is.
I know that the angle should have decimal places, no idea why it keeps giving a number of 1 or 0 and not a decimal (like it should be doing)
I included the cmath and cstdlib in the program. I didn't attach the whole code, because its way too long, and I think I traced the problem down to this equation.