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]
st: precision problem using double
From 
 
Leandro Brufman <[email protected]> 
To 
 
[email protected] 
Subject 
 
st: precision problem using double 
Date 
 
Sat, 15 Oct 2011 02:37:48 -0400 
Been reading some stuff on the precision of double, and how Stata
reads numbers for calculation (in particular this article
http://www.stata-journal.com/sjpdf.html?articlenum=dm0022)
But couldn't find a solution. Here's my problem:
sum  spread
br if spread==`r(max)'
* it returns that there are no observations.
sum spread
br if spread-`r(max)'<smallestdouble()
*it also returns that there are no observations
sum  spread
gen test=spread-`r(max)'
* the minimum number of variable test is -2.84217094e-14
any ideas on how to fix this code? i don't need a lot of precision,
but I do need to have these two lines working fine:
sum  spread
br if spread==`r(max)'
as usual, many many thanks in advance...
*
*   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/