Skip to content

pexp is inaccurate outside the clamping area

Submitted by Christoph Hertzberg @chhtz

Assigned to Nobody

Link to original bugzilla bug (#1693)
Version: 3.4 (development)

Description

Values of large magnitude are clamped by pexp and result in values which should only occur outside that range:

Array4f x(4);  
x << -88.37, -88.38, 88.37, 88.38;  
Array4f y = exp(x);  
Array4f z;  
for(int i=0; i<4; ++i) z(i) = std::exp(x(i));  
std::cout << "x = " << x.transpose() << "\nexp(x) =  " << y.transpose() << "\nshould be " << z.transpose() << "\n";  

Output:
x = -88.37 -88.38 88.37 88.38
exp(x) = 0 0 2.39114e+38 inf
should be 4.18211e-39 4.14052e-39 2.39114e+38 2.41516e+38

Not super-critical, and likely irrelevant in most cases, but getting different results in the scalar and packet implementation is not good.

Depends on

#1687

Edited by Charles Schlosser