aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
diff options
context:
space:
mode:
authorGravatar Rasmus Munk Larsen <rmlarsen@google.com>2019-08-28 12:20:21 -0700
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2019-08-28 12:20:21 -0700
commit1187bb65ad196161a07f4e0125e478d022ea1b08 (patch)
tree86fa97b5b8f1f7377d51cdd202f30a4293b6b9ae /Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
parent6e77f9bef35012f160b307bdeae73194fde91e51 (diff)
Add more tests for corner cases of log1p and expm1. Add handling of infinite arguments to log1p such that log1p(inf) = inf.
Diffstat (limited to 'Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h')
-rw-r--r--Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
index 505a0eec8..0fc673e12 100644
--- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
+++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h
@@ -137,8 +137,9 @@ Packet generic_plog1p(const Packet& x)
Packet xp1 = padd(x, one);
Packet small_mask = pcmp_eq(xp1, one);
Packet log1 = plog(xp1);
+ Packet inf_mask = pcmp_eq(xp1, log1);
Packet log_large = pmul(x, pdiv(log1, psub(xp1, one)));
- return pselect(small_mask, x, log_large);
+ return pselect(por(small_mask, inf_mask), x, log_large);
}
/** \internal \returns exp(x)-1 computed using W. Kahan's formula.