SQFvm / runtime

Custom implementation of the Arma script language SQF
GNU Lesser General Public License v3.0
98 stars 30 forks source link

[BUG] Trigonometric functions use radians in SQF-VM, but degrees in Arma 3 #123

Closed Spoffy closed 4 years ago

Spoffy commented 4 years ago

Describe the bug All of the trigonometric functions (cos, tan, sin, etc) in SQF-VM are backed by the underlying C++ std library functions of the same name.

However, C++ uses radians exclusively for parameters + return values, whereas Arma 3 uses degrees. SQF-VM needs to convert degrees to radians before passing it to the underlying std:: functions.

To Reproduce Steps to reproduce the behavior:

  1. Do sin 30 in SQF-VM. Correct value is 0.5, actual value is not.

Expected behavior sin 30 takes degrees, and returns 0.5.

Additional context Affected operators are (in order of appearance in ops_math.cpp)