[Numpy-discussion] Handling underflow

John J. Lee phrxy at csv.warwick.ac.uk
Fri Feb 23 06:38:54 CST 2001


On 22 Feb 2001, Victor S. Miller wrote:

> Is there some way of having calculations which cause underflow
> automatically set their result to 0.0?  For example when I take
> exp(a), where a is a floating point array.

Not 'automatically', but:

a = whatever()
choose(greater(a, MAX), (a, MAX))
answer = exp(-a)

any good?  This is with a 1D array -- I haven't used higher dimensions
much.


John





More information about the Numpy-discussion mailing list