Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How float number 0.0f represented in memory

I know that decimal numbers are represented in floating point format. every float represented as m2^e where m is mantissa and e is the exponent.

But am not able to find the 0.0f representation.Please provide the steps to get the 0.0f memory representation.

like image 568
venkat Avatar asked Apr 28 '26 04:04

venkat


1 Answers

0, inf, nan, are special values, since their mantissa and exponent cannot be derived. They have defined bit patterns:

 0 = 0 00000000 00000000000000000000000
-0 = 1 00000000 00000000000000000000000

See e.g. http://www.cs.yale.edu/homes/aspnes/pinewiki/C(2f)FloatingPoint.html

like image 192
Ludwig Schulze Avatar answered May 01 '26 09:05

Ludwig Schulze



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!