python 弧度与角度互转

 

import math
def deal(yaw):
        if(yaw<0):
                print(-(abs(yaw)/math.pi)*180)
                print(math.degrees(yaw))
        else:
                print((abs(yaw)/math.pi)*180)
                print(math.degrees(yaw))

yaw=math.pi/6
deal(yaw)
yaw=-math.pi/3
deal(yaw)

输出

30.0
29.999999999999996
-60.0
-59.99999999999999

 

转载于:https://www.cnblogs.com/sea-stream/p/10787813.html

你可能感兴趣的:(python,开发工具)