且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是否有C语言函数来计算度/弧度?

更新时间:2023-11-08 23:02:46

 的#include<&math.h中GT;内嵌双to_degrees(双弧度){
    返回弧度*(180.0 / M_PI);
}

I need to calculate an angle in C programm. Here is a method from JAVA that I need to convert to C.

private static double calculateDirection(double x, double y)
{
    return Math.toDegrees(Math.atan2(y, x));
}

Is there a function like toDegrees in C language so I don't have to write all the code by myself? Thank you

#include <math.h>

inline double to_degrees(double radians) {
    return radians * (180.0 / M_PI);
}