ClickHouse/src/Functions/radians.cpp

31 lines
600 B
C++
Raw Normal View History

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 RadiansName
{
static constexpr auto name = "radians";
};
2022-01-20 05:48:32 +00:00
template <typename T>
Float64 radians(T d)
{
Float64 radians = d * (M_PI / 180);
return radians;
}
using FunctionRadians = FunctionMathUnary<UnaryFunctionVectorized<RadiansName, radians>>;
2022-01-19 06:42:16 +00:00
}
void registerFunctionRadians(FunctionFactory & factory)
{
factory.registerFunction<FunctionRadians>(FunctionFactory::CaseInsensitive);
}
}