Question: I am sure this code is correct! Why I use this Code by using float_neg(2), it outputs -2147483646? it should output -2? NAN means not

I am sure this code is correct!

Why I use this Code by using float_neg(2), it outputs -2147483646? it should output -2? NAN means not a number, just like a string ?

unsigned float_neg(unsigned uf) {

unsigned res = 0;

unsigned tmp = 0;

2 tmp = uf & 0x7fffffff;

-2 res = uf ^ 0x80000000;

if(tmp > 0x7f800000)

res = uf;

return res;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!