I've been working on a Calculator application as one of my first big projects. I recently programmed my calculator to give the results of an inverse trig function. It works fine in radians, but gives very weird numbers in degrees that are incorrect. For example, the correct value of inverse sine of 1 in degrees is 90 degrees. However, if I run it through my program, I get the result 0.01745417873758517 for inverse sine of 1.
This deals with the Inverse Sine function.
If degreeAngle equals true, then it would convert the number to degrees. But even though you deal with Radians by default, if I use the toDegrees method, then it doesn't yield the correct number.
What's exactly going on? Am I doing something wrong? I'm using Eclipse as my developer software.
This deals with the Inverse Sine function.
Code:
case 25: //Inverse Sine
{
isValid=true;
if((procedure > 1) && (inOperation==false))
{
currentNumber=totalNumber;
}
if (degreeAngle==true)
{
currentNumber=StrictMath.toRadians(currentNumber);
}
if ((inOperation==false) && (isValid==true))
{
totalNumber = StrictMath.asin(currentNumber);
}
else if (isValid==true)
{
currentNumber=StrictMath.asin(currentNumber);
inFunction=true;
}
break;
}
If degreeAngle equals true, then it would convert the number to degrees. But even though you deal with Radians by default, if I use the toDegrees method, then it doesn't yield the correct number.
What's exactly going on? Am I doing something wrong? I'm using Eclipse as my developer software.