Skip to content
Snippets Groups Projects
Commit 8975c70c authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Add `trunc`, `rint`, `lrint`, `round` and `lround` functions

parent 7ca7bc7b
No related branches found
No related tags found
1 merge request!37Feature/language
......@@ -49,4 +49,19 @@ CMathModule::CMathModule()
this->_addFunction("pow",
std::make_shared<CFunctionEmbedder<double, double, double>>(std::function<double(double, double)>{
[](double x, double y) -> double { return std::pow(x, y); }}));
this->_addFunction("trunc", std::make_shared<CFunctionEmbedder<double, double>>(
std::function<double(double)>{[](double x) -> double { return std::trunc(x); }}));
this->_addFunction("round", std::make_shared<CFunctionEmbedder<double, double>>(
std::function<double(double)>{[](double x) -> double { return std::round(x); }}));
this->_addFunction("lround", std::make_shared<CFunctionEmbedder<int64_t, double>>(
std::function<int64_t(double)>{[](double x) -> int64_t { return std::lround(x); }}));
this->_addFunction("rint", std::make_shared<CFunctionEmbedder<double, double>>(
std::function<double(double)>{[](double x) -> double { return std::rint(x); }}));
this->_addFunction("lrint", std::make_shared<CFunctionEmbedder<int64_t, double>>(
std::function<int64_t(double)>{[](double x) -> int64_t { return std::lrint(x); }}));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment