28namespace func_sketch::math {
40 [[nodiscard]]
static std::string_view
name() noexcept {
return "add"; }
52 [&result](
const auto& left_value,
const auto& right_value) {
54 CommonType<
decltype(left_value),
decltype(right_value)>;
55 result =
static_cast<ResultType
>(left_value) +
56 static_cast<ResultType
>(right_value);
72 [[nodiscard]]
static std::string_view
name() noexcept {
return "sub"; }
84 [&result](
const auto& left_value,
const auto& right_value) {
86 CommonType<
decltype(left_value),
decltype(right_value)>;
87 result =
static_cast<ResultType
>(left_value) -
88 static_cast<ResultType
>(right_value);
104 [[nodiscard]]
static std::string_view
name() noexcept {
return "mul"; }
116 [&result](
const auto& left_value,
const auto& right_value) {
118 CommonType<
decltype(left_value),
decltype(right_value)>;
119 result =
static_cast<ResultType
>(left_value) *
120 static_cast<ResultType
>(right_value);
136 [[nodiscard]]
static std::string_view
name() noexcept {
return "div"; }
148 [&result](
const auto& left_value,
const auto& right_value) {
150 CommonType<
decltype(left_value),
decltype(right_value)>;
151 result =
static_cast<ResultType
>(left_value) /
152 static_cast<ResultType
>(right_value);
168 [[nodiscard]]
static std::string_view
name() noexcept {
return "pow"; }
180 [&result](
const auto& left_value,
const auto& right_value) {
Class of addition operator.
static void operator()(const Number &left, const Number &right, Number &result)
Operate on a pair of scalars.
static std::string_view name() noexcept
Get the name of the operator.
Class of division operator.
static std::string_view name() noexcept
Get the name of the operator.
static void operator()(const Number &left, const Number &right, Number &result)
Operate on a pair of scalars.
Class of multiplication operator.
static void operator()(const Number &left, const Number &right, Number &result)
Operate on a pair of scalars.
static std::string_view name() noexcept
Get the name of the operator.
static void operator()(const Number &left, const Number &right, Number &result)
Operate on a pair of scalars.
static std::string_view name() noexcept
Get the name of the operator.
Class of subtraction operator.
static std::string_view name() noexcept
Get the name of the operator.
static void operator()(const Number &left, const Number &right, Number &result)
Operate on a pair of scalars.
Definition of CommonType type.
std::common_type_t< T1, T2 > CommonType
Get common type of two types.
Definitions of common types.
std::variant< Integer, Real, Complex > Number
Type of numbers.
Definition of pow_number function.
auto pow_number(Base base, Exponent exponent)
Compute power for number types in this library.