Nearest integer floating point operations¶
xtensor provides the following rounding operations for xexpressions:
Defined in xtensor/xmath.hpp
-
template<class
E
>
autoxt
::
ceil
(E &&e)¶ ceil function.
Returns an xfunction for the element-wise smallest integer value not less than e.
- Return
an xfunction
- Parameters
e
: an xexpression
-
template<class
E
>
autoxt
::
floor
(E &&e)¶ floor function.
Returns an xfunction for the element-wise smallest integer value not greater than e.
- Return
an xfunction
- Parameters
e
: an xexpression
-
template<class
E
>
autoxt
::
trunc
(E &&e)¶ trunc function.
Returns an xfunction for the element-wise nearest integer not greater in magnitude than e.
- Return
an xfunction
- Parameters
e
: an xexpression
-
template<class
E
>
autoxt
::
round
(E &&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.
- Return
an xfunction
- Parameters
e
: an xexpression
-
template<class
E
>
autoxt
::
nearbyint
(E &&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.
- Return
an xfunction
- Parameters
e
: an xexpression
-
template<class
E
>
autoxt
::
rint
(E &&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.
- Return
an xfunction
- Parameters
e
: an xexpression