X
x.mar
For float points variables x and a, does "x>a" always give "x-a>0" and
vice versa?
vice versa?
Yes, as far as I know, but you shouldn't rely on it. I think everyFor float points variables x and a, does "x>a" always give "x-a>0" and
vice versa?
For float points variables x and a, does "x>a" always give "x-a>0" and
vice versa?
Not when abrupt underflow is set, if I can make assumptions about yourFor float points variables x and a, does "x>a" always give "x-a>0" and
vice versa?
Eric Sosman said:For finite floats, I think so. However, if x is Inf and a is -Inf,
x>a is true but x-a == NaN and NaN > 0 is false.
I think (though I don't have the standard handy) that Inf - (-Inf) ==
Inf rather than NaN in IEEE floating-point arithmetic, and it seems a
sounds choice for any FP implementation.
For float points variables x and a, does "x>a" always give "x-a>0" and
vice versa?
x.mar said:Thank all for the replies. I encountered this question when I am
implementing an image analysis algorithm where I need to inspect a
line segment over an image pixel by pixel. So the question should be
looked at in the context of such; the range of x and a will span no
more than 4-5 order of magnitude, typically 0.1-1000.0. We can safely
assume situations such INF and NaN are safely guarded elsewhere.
With this restriction in place can I safely assume x-a>0 will be true
if x>a is true?
Thanks!
The problem related to abrupt underflow will bite you only whenThank all for the replies. I encountered this question when I am
implementing an image analysis algorithm where I need to inspect a
line segment over an image pixel by pixel. So the question should be
looked at in the context of such; the range of x and a will span no
more than 4-5 order of magnitude, typically 0.1-1000.0. We can safely
assume situations such INF and NaN are safely guarded elsewhere.
With this restriction in place can I safely assume x-a>0 will be true
if x>a is true?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.