hikyuu2/hikyuu_pywrap/_arithmetic.cpp

45 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* _util.cpp
*
* Created on: 2011-12-4
* Author: fasiondog
*/
#include <hikyuu/utilities/arithmetic.h>
#include "pybind_utils.h"
using namespace hku;
namespace py = pybind11;
void export_util(py::module& m) {
m.def("roundEx", roundEx<float>, py::arg("number"), py::arg("ndigits") = 0);
m.def("roundEx", roundEx<double>, py::arg("number"), py::arg("ndigits") = 0,
R"(roundEx(number[, ndigits=0])
ROUND_HALF_EVEN
:param float number
:param int ndigits
:rype: float)");
m.def("roundUp", roundUp<float>, py::arg("number"), py::arg("ndigits") = 0);
m.def("roundUp", roundUp<double>, py::arg("number"), py::arg("ndigits") = 0,
R"(roundUp(number[, ndigits=0])
10.111
:param float number
:param int ndigits
:rtype: float)");
m.def("roundDown", roundDown<float>, py::arg("number"), py::arg("ndigits") = 0);
m.def("roundDown", roundDown<double>, py::arg("number"), py::arg("ndigits") = 0,
R"(roundDown(number[, ndigits=0])
10.110
:param float number
:param int ndigits
:rtype: float)");
}