Search code examples
c++cmath

cmath asin() problems


Hey so i managed to locate the problem in some graphics math i am coding, and apparently when i reach this line of code: float test3= asin(test2); where test2= 0.017409846.

to my understanding 'asin' is 'arc sin' which is 'inverse sin' (what i want) the result of this line of code however is test3 = 0.017410725. when plugging this into my calculator inverse sine of test2 is .997561.

Why isn't asin working?? thanks!


Solution

  • Your calculator is set to degrees mode. The asin() function returns radians.

    Degrees and radians are related by the formula:

    degrees = (180/π) * radians