1. Why aren’t floating point numbers accurate

We code farmers in the program to write 10 decimal, computer internal can not use binary decimal to accurately express.

Let’s try to express 0.2 in decimal.


               

2. Floating-point computer representation

So what’s going on inside the computer?


               

32 –
A 64 – bit
Need to transform:
If it’s not 0 or 255, then you need to subtract a value called the offset, which is 127 for float

3. Use floating point numbers

Chances are you won’t get what you want.

Disclaimer: Original article, all rights reserved, unauthorized reprint prohibited

What you’ve seen is just the tip of the iceberg.


               

I’m a thread

I’m a Java class

Javascript: A loser’s counterattack

Java: The Birth of an Empire

Basic: A veteran’s account

Wang’s path as an architect

The skills a programmer needs to do his job

The unwritten rules a coder needs to know

TCP/IP of the Ming Dynasty mailman

CPU forrest gump

Why is IE killing Chrome and Firefox

Node.js: ALL I need is a waitress

Suppose I am a computer science teacher

This is how I would learn Java if I could go back in time

Learn programming, not Java

15 years of programming career, 7 experiences summarized by senior architect