From 19876ced76bd1730008e02fc4c43c2228faed38a Mon Sep 17 00:00:00 2001 From: Ilya Tokar Date: Mon, 16 Dec 2019 16:00:35 -0500 Subject: Bug #1785: Introduce numext::rint. This provides a new op that matches std::rint and previous behavior of pround. Also adds corresponding unsupported/../Tensor op. Performance is the same as e. g. floor (tested SSE/AVX). --- doc/CoeffwiseMathFunctionsTable.dox | 11 +++++++++++ doc/snippets/Cwise_rint.cpp | 3 +++ 2 files changed, 14 insertions(+) create mode 100644 doc/snippets/Cwise_rint.cpp (limited to 'doc') diff --git a/doc/CoeffwiseMathFunctionsTable.dox b/doc/CoeffwiseMathFunctionsTable.dox index 8186a5272..ce2f5e097 100644 --- a/doc/CoeffwiseMathFunctionsTable.dox +++ b/doc/CoeffwiseMathFunctionsTable.dox @@ -394,6 +394,17 @@ This also means that, unless specified, if the function \c std::foo is available plus \c using \c std::round ; \cpp11 SSE4,AVX,ZVector (f,d) + + + \anchor cwisetable_rint + a.\link ArrayBase::rint rint\endlink(); \n + \link Eigen::rint rint\endlink(a); + + nearest integer, \n rounding to nearest even in halfway cases + built-in generic implementation using \c std::rint + or \c rintf; + SSE4,AVX (f,d) + Floating point manipulation functions diff --git a/doc/snippets/Cwise_rint.cpp b/doc/snippets/Cwise_rint.cpp new file mode 100644 index 000000000..1dc7b2fd1 --- /dev/null +++ b/doc/snippets/Cwise_rint.cpp @@ -0,0 +1,3 @@ +ArrayXd v = ArrayXd::LinSpaced(7,-2,2); +cout << v << endl << endl; +cout << rint(v) << endl; -- cgit v1.2.3