Compute the sign of an integer without branching

Write an efficient function to Compute the sign of an integer without branching (if statements etc..)

Compute the sign of an integer without branching

Try this:

sign=((sqrt(number*number))/(-1*number))+44;

Regards,

Compute the sign of an integer without branching

Well, estentially the conditional operater is just a convienent way to write and if-else

The algorithm should not have ANY kind of branching statements

Compute the sign of an integer without branching

Is this what you expecting?:

sign = (0 < givenNumber)? '+' : '-' ;