Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: precision problem using double


From   Leandro Brufman <leandrobrufman@gmail.com>
To   statalist@hsphsun2.harvard.edu
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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index