1.#QNAN Solution

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue May 8 20:33:54 EDT 2007


En Tue, 08 May 2007 14:14:58 -0300, Greg Corradini  
<gregcorradini at gmail.com> 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).

-- 
Gabriel Genellina




More information about the Python-list mailing list