Why is (1/0.3) = 3.3333333333333335 ? Where does the 5 come from?

Thank you!

Recommended Answers

All 3 Replies

Floating point math on digital chips is notoriously difficult, and you need to throw away the last bits at the least. My good friend and college buddy Bruce Ravenel designed the architecture of the Intel 8087 math co-processor (https://en.wikipedia.org/wiki/Intel_8086) which was the first implementation of the IEEE floating point standard on a chip. By doing all computations in 80 bits internally (instead of the 64 bit double precision floating point standard), he was able to truncate the result and store to a 64 bit variable without loss of precision like what you see. Here is the specific article on the 8087 chip set which will answer some of your questions: https://en.wikipedia.org/wiki/Intel_8087

BTW, when he retired, Bruce was VP of engineering at SBC global (now AT&T).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.