Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Subject: RE: RE: st: A bug in egen and gen?
From
"Clyde Schechter" <[email protected]>
To
[email protected]
Subject
Subject: RE: RE: st: A bug in egen and gen?
Date
Sun, 20 Feb 2011 09:45:25 -0800
So, there has been this long, sometimes heated, thread about float vs.
double. The question was raised why we need to convert to double for
calculations if float is more than adequate precision for storing results.
Maarten Buis points out that in a long series of calculations, small
errors can build up and wipe out the precision of floats. This is true.
But the situation is even worse than that.
Just a single floating point addition or subtraction involving two numbers
which differ by several orders of magnitude can obliterate all of the
precision of a float number. This is because in floating point arithmetic
the mantissas must be "shifted" until the exponents are equal to perform
the operation. If the exponents differ sufficiently, the smaller number
can be shifted all the way out of floating point precision. (In
principle, adding or subtracting two floating point numbers can obliterate
the precision of a double--but the difference between them must be even
more extreme and as a practical matter this problem arises less often.)
Clyde Schechter
Albert Einstein College of Medicine
Bronx, NY, USA
Please note new e-mail address: [email protected]
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/