0

I'm having trouble using the arcsine() function. When I use this code:

#include <iostream>

#include <math.h>

using namespace std;

int main() {
  cout << asin(12 / 13);
}

I get 0 as a result, whereas the calculator gives 30* which is 1/6 pi-radians. If I use the code that the c++ reference site gives, as follows, it returns this value for me "The arcsine of 0.5 is -nan(ind) degrees.".

#include <stdio.h>

#define PI 3.14159265

#include <iostream>

#include <math.h>

using namespace std;

  int main() {

  double param, result;

  param = 0.5;

  result = asin((param) \* 180.0 / PI);

  printf("The arc sine of %f is %f degrees\\n", param, result);

  return 0;
}

Also, the base trig functions don't seem to give a very accurate reading for me: when I get sin(theta) = 1 with a calculator I get like 0.85 in my editor. Could it be it's because I'm using Visual Studio Community which is possibly sub-par to other versions of it?

Also, I tried using the 'insert code' tool of this site to quote the second block of code but the didn't appear and all that showed was "put the code here" so I just had to guess where to put it and that's the best I could do.

0 Answers0