2022-01-20 05:48:32 +00:00
|
|
|
#include <DataTypes/IDataType.h>
|
2022-01-19 06:42:16 +00:00
|
|
|
#include <Functions/FunctionFactory.h>
|
|
|
|
#include <Functions/FunctionMathUnary.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
struct DegreesName
|
|
|
|
{
|
|
|
|
static constexpr auto name = "degrees";
|
|
|
|
};
|
|
|
|
|
2022-01-22 18:44:36 +00:00
|
|
|
Float64 degrees(Float64 r)
|
2022-01-20 05:48:32 +00:00
|
|
|
{
|
|
|
|
Float64 degrees = r * (180 / M_PI);
|
|
|
|
return degrees;
|
|
|
|
}
|
|
|
|
|
|
|
|
using FunctionDegrees = FunctionMathUnary<UnaryFunctionVectorized<DegreesName, degrees>>;
|
2022-01-19 06:42:16 +00:00
|
|
|
}
|
|
|
|
|
2022-07-04 07:01:39 +00:00
|
|
|
REGISTER_FUNCTION(Degrees)
|
2022-01-19 06:42:16 +00:00
|
|
|
{
|
2022-08-27 20:06:03 +00:00
|
|
|
factory.registerFunction<FunctionDegrees>({}, FunctionFactory::CaseInsensitive);
|
2022-01-19 06:42:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|