FuncSketch
Loading...
Searching...
No Matches
misc_float_operations.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2026 MusicScience37 (Kenta Kabashima)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
22
23#include <cmath>
24
29
30namespace func_sketch::math {
31
33 return MathFunction(
35 "abs", [](auto arg) { return std::abs(arg); }));
36}
37
39 return MathFunction(
41 "ceil", [](Real arg) { return std::ceil(arg); }));
42}
43
45 return MathFunction(
47 "floor", [](Real arg) { return std::floor(arg); }));
48}
49
51 return MathFunction(
53 "trunc", [](Real arg) { return std::trunc(arg); }));
54}
55
57 return MathFunction(
59 "round", [](Real arg) { return std::round(arg); }));
60}
61
62} // namespace func_sketch::math
Definition of AcceptableTypes struct.
Class of mathematical functions.
Definitions of common types.
double Real
Type of real numbers in this project.
Definition of GeneralMathFunction class.
auto make_general_math_function(std::string name, FunctionType &&function)
Make a general mathematical function.
Definition of MathFunction class.
Declaration of functions to create functions of miscellaneous floating-point operations.
MathFunction round_function()
Create round function.
MathFunction trunc_function()
Create trunc function.
MathFunction ceil_function()
Create ceil function.
MathFunction floor_function()
Create floor function.
MathFunction abs_function()
Create abs function.
Traits struct to handle acceptable number types.