Integers and Doubles

What is an Integer

Well to put it simply an integer is a number! More specifically it is a whole number. It can be abbrivated, int and takes up half of the memory that a double uses, it uses four bytes of memory or 32 bits. Integers are very important because you will use them in just about every program you create. One instance inwhcih you would want to use and integer is when counting the number of people are in an area at one time or when you need to round number. It is useful when you need your output to be a whole number, you can't have half a person!

What is a Double?

A double is also a way of representing a number, but it is different than an integer. It uses twice the amount of memory that a integer does, eight bytes or 64 bits. It takes up more memory because it includes floating point values ( aka decimals ). You would typically use a double when you want a more precise answer that you do not want to round. An example of this would be using an algorithm that calculates the circumferance ofa cirle and you want that to be exact.

Summary

Data Type Integers Doubles
What Does it Look Like? int double
Type of Number Whole Numbers Only Includes Decimals
Amount of Memory Used 32 bits 64 bits