ClickHouse/src/Functions/radians.cpp

28 lines
504 B
C++
Raw Normal View History

2022-01-19 06:42:16 +00:00
#include <Functions/FunctionFactory.h>
#include <Functions/FunctionMathUnary.h>
template <typename T>
T radians(T d)
{
2022-01-19 07:24:55 +00:00
return d * (M_PI / 180);
2022-01-19 06:42:16 +00:00
}
namespace DB
{
namespace
{
struct RadiansName
{
static constexpr auto name = "radians";
};
using FunctionRadians= FunctionMathUnary<UnaryFunctionVectorized<RadiansName, radians>>;
}
void registerFunctionRadians(FunctionFactory & factory)
{
factory.registerFunction<FunctionRadians>(FunctionFactory::CaseInsensitive);
}
}