I'm trying to simplify fractions in binary with this code that checks if the value is even:
int is_even(floatlet value){
if(value & 1) return 0;
return 1;
}
And this while loop keeps bit shifting until the value is odd.
while(is_even(numerator) && is_even(denomExp)){
numerator >>= 1;
denomExp <<= 1;
}
The while loop goes on an infinite loop. I'm wondering why? We've done test and the is_even function works fine. Thanks!