Oct-24-2019, 03:23 AM
(Oct-24-2019, 01:33 AM)SheeppOSU Wrote: I was trying to get the tangent of a degree, but math.tan returns the radian
math.tan(x)
doesn't return radians (it returns value of tangent for specific angle -- x which is (expected to be) given in radians). math.atan
is inverse function to math.tan
, therefore, it returns radians. So, math.tan(x)
requires x to be in radians. If you want to calculate, e.g. tan(60 degrees), you need to convert 60 degrees to radians: tan(60 degrees) = math.tan(math.radians(60))
. Note, that conversion between radians and degrees is very simple: math.radians(deg) = deg * math.pi / 180.0
.