I found and fixed the problem. I had performed a distance computation of all point to all points. My points included a query point and I needed to set its distance to something large. So I did distances[query_point] = 1e308; ts = distances / band_width; x = ts * ts and got the overflow, which makes sense. I am eventually going to mask out x values that are greater than 1, so the fix is to set distances[query_point] = 1e10 because I know the geography and know that no reasonable distance exceeds this.
Thanks, Chuck for your help. Roy On Sun, Jul 10, 2011 at 11:00 PM, Charles R Harris < [email protected]> wrote: > > > On Sun, Jul 10, 2011 at 8:26 PM, Roy Lowrance <[email protected]>wrote: > >> I have a 1D float64 array ts. I want to square each element, so I compute >> x = ts * ts >> >> I get a floating point overflow error. >> >> However, when I access each element separately and multiple, I get no >> error: >> for i in ts.shape[0]: >> >> > Data please. The element by element squaring is handled by python, not > numpy, so I expect numpy and python handle the errors differently. Catching > floating point errors is a bit unreliable in any case. What OS/compiler are > you using? Are you running 32 bit or 64 bit? > > Chuck > > _______________________________________________ > NumPy-Discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > -- Roy Lowrance home: 212 674 9777 mobile: 347 255 2544
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
