akarl wrote:

> sabarish wrote:

>

>> Hi to all. find out the biggest among two numbers without using any

>> conditional statements and any relational operators.

>

> It's simple as well as off topic (since it's not C specific):

>

> max(x, y) = (x + y + |x - y|) / 2
Is it?

Implementation-wise, apart from the problematic cases, as Eric pointed

out, there is another issue. The absolute value. How do you compute it

with no conditional statement? Just using fabs() or some other

library function doesn't make it any better. There *has* to be some

conditional statement hidden somewhere. (Or else, tell me how you do

it.) So this doesn't solve the problem which says "without using any

conditional statements and any relational operators".

Ok, some implementations of fabs() may not need a conditional

statement (it may be able to modify the sign without any condition),

but that's not guaranteed.

And to me, formally speaking, an absolute value is a conditional

statement in itself.

Anyway, the question looked like YASHWA to me.

(= Yet Another Stupid HomeWork Assignment

)