+ 4
Im not clear about floats
10 Answers
+ 13
a float is just any real number. 1.0, 2.575436789632, -0.333 are examples of floats. like @alCosecant Maths said: floats are just decimals.
If you use the / operator, it will return a float.
2/1 == 2.0
to convert any other numerical datatype to a float, use the float method. E.g:
x = float(5)
x == 5.0
+ 9
me either man
why float when you can sink!
+ 2
ok a beginner can take it to be like decimals . . .
+ 2
Floats are not really decimals, we have a completely separate module for that. it is like scientific notation in base 2, more or less
0
division operation always gives a float
0
k thanks @amaras
0
rest or move on or near the surface of a liquid without sinking.
- 1
A float is NOT an exact value, there are several errors with that... for instance, there is a smallest float, not a smallest real number
- 2
a float means exact value. 10/5=5.0 n 5 is also correct
but in any programming once assign as float number must be ending with .0 or some number.
- 2
@Naveen no, it doesn't return a decimal, it returns a float. For instance, 0.1 + 0.1 + 0.1 != 0.3 That's not decimal, there is a separate module for that