Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text to floating point: how does it work

Say, I write down in a programming language the characters 5.4 and store it into a double variable. How exactly does a computer decide what floating point representation (mantissa and exponent) is the closest to that number?

like image 388
Michiel Borkent Avatar asked Oct 28 '25 20:10

Michiel Borkent


1 Answers

I once described this, in a simple, easily understood way, for the value 5.2, see this SO article.

like image 185
Rudy Velthuis Avatar answered Oct 31 '25 11:10

Rudy Velthuis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!