## Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

## ← Doubles Are Fuzzy - Intro to Java Programming

• 2 Followers
• 26 Lines

### Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): ```<script type="text/javascript" src='https://amara.org/embedder-iframe'></script> ``` Paste this inside your HTML body, where you want to include the widget: ```<div class="amara-embed" data-url="http://www.youtube.com/watch?v=ls5-Nlfk83s" data-team="udacity"></div> ``` 6 Languages

Showing Revision 4 created 05/25/2016 by Udacity Robot.

1. The problem here, is that the computer, works
2. internally in a different number system called the
3. binary number system, and there's no exact representation
4. for 4.35 in that system. It's kind of
5. similar to your pocket calculator. When you divide
6. ten by three, you get 3.3333 and so
7. on. And then when you multiply again with
8. three, you would get 9.999999 and so on.
9. And the reason is that there is no
10. exact representation for the fraction ten over three
11. in the decimal system. Now as programmers, we
12. don't usually worry about the detail reasons why these
13. round of errors occur, we just have the
14. general intuition that floating point numbers are a little
15. bit fuzzy. Just like the fuzzy photo over
16. here, you can't quite rely on every last pixel.
17. So when you get a number like 434.999 and
18. so on, that's just something we have to deal with.
19. Now, in this case, if we don't want to
20. lose any pennies, the remedy would be to use integers
21. and work in pennies. If this had been 435
22. pennies as an integer, a 100 times 435 would not
23. have been a problem. There are several other number
24. types in Java that you may need in more technical
25. situations, we've prepared a fact sheet for you. Go ahead, read through
26. the worksheet, and then work with Sarah on a few quiz questions