# Nearest integer floating point operations

xtensor provides the following rounding operations for xexpressions:

Defined in `xtensor/xmath.hpp`

template<class E>
inline auto xt::ceil(E &&e) noexcept -> detail::xfunction_type_t<math::ceil_fun, E>

  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 auto xt::floor(E &&e) noexcept -> detail::xfunction_type_t<math::floor_fun, E>

  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 auto xt::trunc(E &&e) noexcept -> detail::xfunction_type_t<math::trunc_fun, E>

  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 auto xt::round(E &&e) noexcept -> detail::xfunction_type_t<math::round_fun, E>

  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 auto xt::nearbyint(E &&e) noexcept -> detail::xfunction_type_t<math::nearbyint_fun, E>

  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 auto xt::rint(E &&e) noexcept -> detail::xfunction_type_t<math::rint_fun, E>

  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