Integer and Float

In most programming languages (and Ruby is no exception), numbers without decimal points are called integers, and numbers with decimal points are usually called floating-point numbers or, more simply, floats.

Here are some integers:

5
-205
9999999999999999999999999
0

And here are some floats:

54.321
0.001
-205.3884
0.0

In practice, most programs don’t use floats; they use only integers. (After all, no one wants to look at 7.4 emails, browse 1.8 web pages, or listen to 5.24 of their favorite songs.) Floats are used more for academic purposes (physics experiments and such) and for audio and video (including 3D) programs. Even most money programs use integers; they just keep track of the number of pennies!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.11.89