Question: CAN SOMEONE PLEASE EXPLAIN THIS ASAP int float_f2i(unsigned uf) { int exp = (uf >> 23) & exFF; /*8 exponent bits*/ int frac = uf

 CAN SOMEONE PLEASE EXPLAIN THIS ASAP int float_f2i(unsigned uf) { int

CAN SOMEONE PLEASE EXPLAIN THIS ASAP

int float_f2i(unsigned uf) { int exp = (uf >> 23) & exFF; /*8 exponent bits*/ int frac = uf & ex7FFFFF; /*23 fraction bits/ int e = exp - 127; /*amount to shift normalized values by (bias of 127)*/ /*returns if NaN*/ if (exp == 8x7F820000) return ex8eeeeeeeu; /*rounds down to zero if exponent is zero / if(!exp) return ; /*rounds down to zero if there are no left shifts*/ if(e 30) return ex8eeeeeee; frac = frac ex800000; /*normalized, append a 1 to the left of the frac/ if (e >= 23) frac = frac (-23); /*shift left if shift > 23*/ else frac = frac >> (23-e); /*else we need to shift right/ if(( uf >> 31 ) & 1) return -frac + 1; /*return negated value if sign bit is 1*/ return frac

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!