+ 1
Floating point representation
https://code.sololearn.com/c2B6a34Mnox0/?ref=app Please tell me the reason for why there is 1 in the last bit ~ swim ~ 👑 Prometheus 🇸🇬
2 Respuestas
+ 6
It's because of how they're stored in binary. The relevant repeating binary approximation stored leads to this.
For example, 1/10 is represented by:
0.0001100110011001100110011001100110011001100110011...
Terminate this at any value, and you get an imprecise value when converted back to decimal.