DEV Community

Nozibul Islam
Nozibul Islam

Posted on

5 4 4 4 4

How Do Floating Point Numbers Work?

We often use floating-point numbers in programming, but have we ever thought about how they actually work?

Let’s take a look at the following binary number: 1111.1101

How is it converted to a decimal number?

🔹 Integer Part (1111)

Binary value: (1×8) + (1×4) + (1×2) + (1×1) = 15

🔹 Fractional Part (.1101)

Binary value: (1×1/2) + (1×1/4) + (0×1/8) + (1×1/16) = 0.8125

Final Conversion:

1111.1101 (Binary) = 15.8125 (Decimal)

Top comments (2)

Collapse
 
dorinandreidragan profile image
dorinandreidragan

short and sweet 👍

Collapse
 
nozibul_islam_113b1d5334f profile image
Nozibul Islam

thanks

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More