Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Tue, 08 May 2007 14:14:58 -0300, Greg Corradini > <[EMAIL PROTECTED]> escribió: > > > I'm running descriptive stats on mileages from a database (float numbers, > > about a million records). My sum returns 1.#QNAN, which I understand from > > searching this forum is an error. > > > > While I'm looking for help in solving this problem, I'm more interested > > in a > > general explanation about the cause of this problem. Any ideas? > > If you are summing a million floating point numbers, using a naive > algorithm may give you wrong results. > Look for "Kahan summation algorithm" (even discussed some weeks ago in > this group).
Or, just check <http://en.wikipedia.org/wiki/Kahan_summation_algorithm> etc. I can't think offhand of a case where using the wrong/naive algorithm would give a NAN while Kahan's would converge, tho. Alex -- http://mail.python.org/mailman/listinfo/python-list