Answered step by step
Verified Expert Solution
Question
1 Approved Answer
int isGreater ( int x , int y ) { int signx = ( x > > 3 1 ) & 1 ; int signy
int isGreaterint x int y
int signx x & ;
int signy y & ;
int sameVal x y;
int sameSign signx signy;
int signDifference x ~y & is difference between x and y pos or ned
return signDifference & sameSignsameVal & sameSign signDifference;
isGreater if x y then return else return
Example: isGreater isGreater
dont use any operations besides ~ &
use a maximum of operations total
My function is not handling the case isGreater xx or xx correctly. How could I modify it and what am I missing?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started