Eli5: What is a truncation problem?

883 views

Hey, I’m learning Python and the book is talking about truncation problems when i creat float Numbers out of fractions or decimals. I know what it looks like but I don’t really understand what it means. Please help.

In: Mathematics

4 Answers

Anonymous 0 Comments

“Truncated” means to be cut off. The problem that usually arises in computing is when you have a fraction/division that results in a number where the part to the right of the decimal point goes on forever. Since you don’t want to do math that takes an infinite amount of time, at some point you cut it off.

That can make future calculations very slightly wrong. It can be a bit annoying when you calculate 1/3 + 2/3 and get an answer of 0.9999999999. It doesn’t really matter usually, but it’s not pretty and clearly not precise.

You are viewing 1 out of 4 answers, click here to view all answers.