+ 1
What is the double type for?
Is the double type simply for non-integer numbers or is there more to it. Why is it called "double?"
3 Respuestas
+ 5
A double is indeed for non-integer number like 56,345
An int can't deal with the floating point ( , ) so only numbers like 56345
The name double comes from twice the size of a single precusion orn float. Where a single is 32bit a double is 64bit. So a double can hold a wider range of numbers than a single float.
+ 2
The double variable is used for when you need to hold very large variables. doubles are floating point numbers that are DOUBLE (Get it? (float = 32 bit, double = 64 bit)) the size. The allows you to hold numbers with greater precision. 99% of your applications will use float so I wouldn't worry about grasping them to early on. But I would definitely recommend gaining an understanding into what floating point numbers are and what twos complement is.
Here is a youtube video on Floating Point Numbers:
https://www.youtube.com/watch?v=PZRI1IfStY0
Here is a wiki:
https://en.wikipedia.org/wiki/Floating-point_arithmetic
+ 2
I think I understand now. Thanks for your help! It's greatly appreciated.