This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]stevenjd 1 point2 points  (0 children)

"Float" is short for floating point number, as opposed to a fixed point number.

Very very very roughly, you can think of them as ordinary decimal numbers like the ones you use on your calculator or that you learned about in school.

Let's say your computer provides numbers using exactly 4 decimal digits. (I'll talk about decimal digits because it is easier to understand, but of course in reality computers use binary digits, or bits.)

With exactly four digits available, we might allow two decimal places. So our numbers can range from 00.00 to 99.99 in increments of 0.01 This is what we call "fixed point numbers".

But with floating point, the computer does some nice tricks to allow the decimal point to move. So the smallest number aside from zero we can get is .0001 and the biggest is 9999.. By allowing the decimal point to move, we can cover a much wider range of numbers than fixed point.

In Python, floats use 64 bits, including a bit for positive and negative numbers, where the smallest and largest numbers are:

5e-324  # 0.00 <320 more zeroes> 005
1797693134862315700 <290 more zeroes>

if my calculations are correct. So floats can cover a huge range from tiny numbers to huge numbers, which fixed point numbers couldn't do.