aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Functions/degrees.cpp
blob: 3aa20a77a0d10f3bc21f96b0a8f49b4cbf8ca7bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <DataTypes/IDataType.h>
#include <Functions/FunctionFactory.h>
#include <Functions/FunctionMathUnary.h>


namespace DB
{
namespace
{
    struct DegreesName
    {
        static constexpr auto name = "degrees";
    };

    Float64 degrees(Float64 r)
    {
        Float64 degrees = r * (180 / M_PI);
        return degrees;
    }

    using FunctionDegrees = FunctionMathUnary<UnaryFunctionVectorized<DegreesName, degrees>>;
}

REGISTER_FUNCTION(Degrees)
{
    factory.registerFunction<FunctionDegrees>({}, FunctionFactory::CaseInsensitive);
}

}