Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Another precision problem with Mata


From   "Jann Ben" <ben.jann@soz.gess.ethz.ch>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Another precision problem with Mata
Date   Mon, 22 Aug 2005 14:35:29 +0200

Hi,
in a Mata program I am using the expression 

 abs((x-y)/z) < 1

where x, y and z are real scalars. Note that in some cases y has been
set to x + z earlier in the program. Although the expression should
evaluate to "false" in these cases, it sometimes does evaluate to "true"
due to roundoff error.

My question now is: Would it be reasonable to code

 abs((x-y)/z) < 1-epsilon(1)

Or how would one approach such a problem?

Many thanks,
ben

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index