Float vs double


Hi, currently studying first year in IT. I dont really understand the diffference between float and double, and when to use which. Thank you for the replies beforehand.

In: Technology

A double is a float with twice the precision.

Say a float can handle 6-7 significant digits. eg 0.123456 x 10^whatever
A double would be able to handle 15-16 significant digits. eg 0.123456789012345 x 10^whatever.

Say a float takes up 32bits, a double would take up 64 bits.

If you need 15-16 digits, like if you were doing really precise calculations and had memory to spare use a double.
If you’re short on memory and don’t really need it to be that exact use a float.

Double does the same exact thing as afloat, bug it is more precise and can deal with much larger numbers, however it uses twice the memory

Depends on what you need, most of the time it really makes no difference, so you might as well use the smaller one, if you need more precision or larger numbers, go with double