@Rajesh: abs() can be done without conditional operations. There
probably are many ways. The first two that come to mind are:

abs(x) = (x >> 31) & x | ~(x >> 31) & ~x

abs(x) = (x >> 31) ^ x + (x >> 31) & 1

Dave

On Aug 26, 2:56 am, rajesh singarapu <rajesh0...@gmail.com> wrote:
> abs function itself has a condition??????
>
> I think it is not that good solution.
>
>
>
> On Wed, Aug 24, 2011 at 6:33 PM, priyanka raju <priyark...@gmail.com> wrote:
>
> > int a,b,max,min;
> > max=(a+b+abs(a-b))/2;
> > min=(a+b-abs(a-b))/2;
>
> > --
> > cheers
> > priyanka
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to