2019-08-01 00:29:32 +00:00
|
|
|
#include <Functions/FunctionMathUnary.h>
|
2018-12-03 03:17:06 +00:00
|
|
|
#include <Functions/FunctionFactory.h>
|
2019-12-29 01:13:17 +00:00
|
|
|
|
2018-12-03 03:17:06 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2020-09-07 18:00:37 +00:00
|
|
|
namespace
|
|
|
|
{
|
2018-12-03 03:17:06 +00:00
|
|
|
|
|
|
|
struct AsinName { static constexpr auto name = "asin"; };
|
2019-08-01 00:29:32 +00:00
|
|
|
using FunctionAsin = FunctionMathUnary<UnaryFunctionVectorized<AsinName, asin>>;
|
2018-12-03 03:17:06 +00:00
|
|
|
|
2020-09-07 18:00:37 +00:00
|
|
|
}
|
|
|
|
|
2022-07-04 07:01:39 +00:00
|
|
|
REGISTER_FUNCTION(Asin)
|
2018-12-03 03:17:06 +00:00
|
|
|
{
|
2023-04-28 10:10:42 +00:00
|
|
|
factory.registerFunction<FunctionAsin>(FunctionDocumentation
|
2022-08-27 20:06:03 +00:00
|
|
|
{
|
2023-04-28 10:10:42 +00:00
|
|
|
.description=R"(
|
2022-08-27 20:06:03 +00:00
|
|
|
Calculates the arcsine of the argument.
|
|
|
|
|
|
|
|
Takes arbitrary numeric type, which includes floating point and integer numbers, as well as big integers and decimals and returns Float64.
|
|
|
|
|
|
|
|
For arguments in range [-1, 1] it returns the value in range of [-pi() / 2, pi() / 2].
|
|
|
|
|
|
|
|
It represents an inverse function to function 'sin' on this range:
|
|
|
|
[example:inverse]
|
|
|
|
|
|
|
|
It always returns Float64, even if the argument has Float32 type:
|
|
|
|
[example:float32]
|
|
|
|
|
|
|
|
For arguments outside of this range, it returns nan:
|
|
|
|
[example:nan]
|
|
|
|
|
|
|
|
Every self-respectful data scientist knows how to apply arcsine to improve ads click-through rate with ClickHouse.
|
|
|
|
For more details, see [https://en.wikipedia.org/wiki/Inverse_trigonometric_functions].
|
|
|
|
)",
|
2023-04-28 10:10:42 +00:00
|
|
|
.examples{
|
|
|
|
{"inverse", "SELECT asin(1.0) = pi() / 2, sin(asin(1)), asin(sin(1))", ""},
|
|
|
|
{"float32", "SELECT toTypeName(asin(1.0::Float32))", ""},
|
|
|
|
{"nan", "SELECT asin(1.1), asin(-2), asin(inf), asin(nan)", ""}},
|
|
|
|
.categories{"Mathematical", "Trigonometric"}
|
2022-08-27 20:06:03 +00:00
|
|
|
},
|
|
|
|
FunctionFactory::CaseInsensitive);
|
2018-12-03 03:17:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|