0

why np.log(np.exp()) does not return input in this case?

_temp['pct'].values == np.log(np.exp(_temp['pct'].values))

returns

array([False,  True,  True, ..., False, False, False])
Mortz
  • 4,654
  • 1
  • 19
  • 35
  • 4
    Because of float arithmetic error. Use no.allclose to check up to machine precision – jlandercy Oct 20 '22 at 16:01
  • 4
    If you look closely, most values will be relatively close, but not perfectly equal. This is due to floating point precision: https://stackoverflow.com/questions/588004/is-floating-point-math-broken – the_strange Oct 20 '22 at 16:01

0 Answers0