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" <>
To   <>
Subject   st: Another precision problem with Mata
Date   Mon, 22 Aug 2005 14:35:29 +0200

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,

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index