Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 fracStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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