diff options
author | Antonio Sanchez <cantonios@google.com> | 2021-02-09 12:01:09 -0800 |
---|---|---|
committer | Rasmus Munk Larsen <rmlarsen@google.com> | 2021-02-10 22:48:05 +0000 |
commit | 9fde9cce5d261fba692082be6e7bcac04f98a22d (patch) | |
tree | cd0daa151b9edb50c3db9d7c663ed18a794e2e8a /Eigen/src/Core/arch/Default | |
parent | 4cb563a01e0619ea1798c7927f1909755ead2dd8 (diff) |
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.
Diffstat (limited to 'Eigen/src/Core/arch/Default')
-rw-r--r-- | Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h | 8 |
1 files changed, 4 insertions, 4 deletions
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<Packet>(1.0f); const Packet cst_half = pset1<Packet>(0.5f); - const Packet cst_exp_hi = pset1<Packet>( 88.3762626647950f); - const Packet cst_exp_lo = pset1<Packet>(-88.3762626647949f); + const Packet cst_exp_hi = pset1<Packet>( 88.723f); + const Packet cst_exp_lo = pset1<Packet>(-88.723f); const Packet cst_cephes_LOG2EF = pset1<Packet>(1.44269504088896341f); const Packet cst_cephes_exp_p0 = pset1<Packet>(1.9875691500E-4f); @@ -478,8 +478,8 @@ Packet pexp_double(const Packet _x) const Packet cst_2 = pset1<Packet>(2.0); const Packet cst_half = pset1<Packet>(0.5); - const Packet cst_exp_hi = pset1<Packet>(709.437); - const Packet cst_exp_lo = pset1<Packet>(-709.436139303); + const Packet cst_exp_hi = pset1<Packet>(709.784); + const Packet cst_exp_lo = pset1<Packet>(-709.784); const Packet cst_cephes_LOG2EF = pset1<Packet>(1.4426950408889634073599); const Packet cst_cephes_exp_p0 = pset1<Packet>(1.26177193074810590878e-4); |