ClickHouse/src/Functions/radians.cpp

30 lines
555 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-22 18:44:36 +00:00
Float64 radians(Float64 d)
2022-01-20 05:48:32 +00:00
{
Float64 radians = d * (M_PI / 180);
return radians;
}
using FunctionRadians = FunctionMathUnary<UnaryFunctionVectorized<RadiansName, radians>>;
2022-01-19 06:42:16 +00:00
}
REGISTER_FUNCTION(Radians)
2022-01-19 06:42:16 +00:00
{
2022-08-27 20:06:03 +00:00
factory.registerFunction<FunctionRadians>({}, FunctionFactory::CaseInsensitive);
2022-01-19 06:42:16 +00:00
}
}