Trigonometrical functions not return expected Value

Hello dear DevForum community,

I have encountered a very strange bug lately. The problem is that a simple

math.asin()

function doesn’t return the expected value.
For example, calculating the arc sine of 1 in studio gives for me 1.57… which is completely wrong, correct answer would be 90, try on a calculator yourself.

I fear that this is a studio bug, so I would be really glad if someone could test it out this simple line of code in studio and tell me what output you get.

print(math.asin(1))

Roblox, and most software internally, use radians for storing angle data in memory. As it turns out 1.57 radians (pi / 2) is 90 degrees. If you would like to display the calculated angle in degrees you can use math library functions to convert:

print(math.deg(math.asin(1)))

which is doing something similar to

print(180 / math.pi * math.asin(1))
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.