Nearest integer floating point operations
xtensor provides the following rounding operations for xexpressions:
Defined in xtensor/core/xmath.hpp
-
template<class E>
inline detail::xfunction_type_t<math::ceil_fun, E> ceil(E &&e) noexcept ceil function.
Returns an xfunction for the element-wise smallest integer value not less than e.
- Parameters:
e – an xexpression
- Returns:
an xfunction
-
template<class E>
inline detail::xfunction_type_t<math::floor_fun, E> floor(E &&e) noexcept floor function.
Returns an xfunction for the element-wise smallest integer value not greater than e.
- Parameters:
e – an xexpression
- Returns:
an xfunction
-
template<class E>
inline detail::xfunction_type_t<math::trunc_fun, E> trunc(E &&e) noexcept trunc function.
Returns an xfunction for the element-wise nearest integer not greater in magnitude than e.
- Parameters:
e – an xexpression
- Returns:
an xfunction
-
template<class E>
inline detail::xfunction_type_t<math::round_fun, E> round(E &&e) noexcept round function.
Returns an xfunction for the element-wise nearest integer value to e, rounding halfway cases away from zero, regardless of the current rounding mode.
- Parameters:
e – an xexpression
- Returns:
an xfunction
-
template<class E>
inline detail::xfunction_type_t<math::nearbyint_fun, E> nearbyint(E &&e) noexcept nearbyint function.
Returns an xfunction for the element-wise rounding of e to integer values in floating point format, using the current rounding mode. nearbyint never raises FE_INEXACT error.
- Parameters:
e – an xexpression
- Returns:
an xfunction
-
template<class E>
inline detail::xfunction_type_t<math::rint_fun, E> rint(E &&e) noexcept rint function.
Returns an xfunction for the element-wise rounding of e to integer values in floating point format, using the current rounding mode. Contrary to nearbyint, rint may raise FE_INEXACT error.
- Parameters:
e – an xexpression
- Returns:
an xfunction