From 0e6f4e43f1dc0ccfd58be69b5e049cb6c006d9ba Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Fri, 4 Mar 2022 20:41:49 +0000 Subject: [PATCH] Fix a few confusing comments in psincos_float. --- Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 7bc63e059..dedf976cb 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -603,13 +603,13 @@ Packet psincos_float(const Packet& _x) // Scale x by 2/Pi to find x's octant. Packet y = pmul(x, cst_2oPI); - // Rounding trick: + // Rounding trick to find nearest integer: Packet y_round = padd(y, cst_rounding_magic); EIGEN_OPTIMIZATION_BARRIER(y_round) PacketI y_int = preinterpret(y_round); // last 23 digits represent integer (if abs(x)<2^24) - y = psub(y_round, cst_rounding_magic); // nearest integer to x*4/pi + y = psub(y_round, cst_rounding_magic); // nearest integer to x * (2/pi) - // Reduce x by y octants to get: -Pi/4 <= x <= +Pi/4 + // Subtract y * Pi/2 to reduce x to the interval -Pi/4 <= x <= +Pi/4 // using "Extended precision modular arithmetic" #if defined(EIGEN_HAS_SINGLE_INSTRUCTION_MADD) // This version requires true FMA for high accuracy