Float vs double

650 views

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

2 Answers

Anonymous 0 Comments

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.

You are viewing 1 out of 2 answers, click here to view all answers.