Hi can anybody help me in the following question? u16 x, y; //u16 means unsigned integer 16 bit x = y * 0.728 Solve the above equation without using the floating point library and Division method. x and y data type also cannot be changed.
Tricky. How accurate does it need to be? Why 0.728? Where does this question come from? Also, what is the possible range of y? It can be solved if you can use 44 bit arithmetic or more: multiply by 0x02E978D5 and shift the result right by 26 bits, which is accurate to at least 4 decimal places (checked on a spreadsheet) but needs that extra headroom.
Thank you very much for ur kind help. it is an interview question for me to explain in second interview. Ur idea is very nice and i tested in my compiler it is working also Thanks again
yes that one i need to ask u that how u got this value 26 bits have to shift to get this precision? Is there any way to calculate that no:26?
I can't spoon-feed you everything. I'll end up doing your job for you. Think about it and have a few guesses.