From 9fde9cce5d261fba692082be6e7bcac04f98a22d Mon Sep 17 00:00:00 2001 From: Antonio Sanchez Date: Tue, 9 Feb 2021 12:01:09 -0800 Subject: Adjust bounds for pexp_float/double The original clamping bounds on `_x` actually produce finite values: ``` exp(88.3762626647950) = 2.40614e+38 < 3.40282e+38 exp(709.437) = 1.27226e+308 < 1.79769e+308 ``` so with an accurate `ldexp` implementation, `pexp` fails for large inputs, producing finite values instead of `inf`. This adjusts the bounds slightly outside the finite range so that the output will overflow to +/- `inf` as expected. --- Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Eigen/src/Core/arch/Default') diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index 09146f496..452019ecc 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -417,8 +417,8 @@ Packet pexp_float(const Packet _x) { const Packet cst_1 = pset1(1.0f); const Packet cst_half = pset1(0.5f); - const Packet cst_exp_hi = pset1( 88.3762626647950f); - const Packet cst_exp_lo = pset1(-88.3762626647949f); + const Packet cst_exp_hi = pset1( 88.723f); + const Packet cst_exp_lo = pset1(-88.723f); const Packet cst_cephes_LOG2EF = pset1(1.44269504088896341f); const Packet cst_cephes_exp_p0 = pset1(1.9875691500E-4f); @@ -478,8 +478,8 @@ Packet pexp_double(const Packet _x) const Packet cst_2 = pset1(2.0); const Packet cst_half = pset1(0.5); - const Packet cst_exp_hi = pset1(709.437); - const Packet cst_exp_lo = pset1(-709.436139303); + const Packet cst_exp_hi = pset1(709.784); + const Packet cst_exp_lo = pset1(-709.784); const Packet cst_cephes_LOG2EF = pset1(1.4426950408889634073599); const Packet cst_cephes_exp_p0 = pset1(1.26177193074810590878e-4); -- cgit v1.2.3