+ 4

Im not clear about floats

13th Feb 2017, 9:09 AM
Mathushan Mahendren
Mathushan Mahendren - avatar
10 Antworten
+ 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
13th Feb 2017, 10:55 AM
Aidan Haddon-Wright
Aidan Haddon-Wright - avatar
+ 9
me either man why float when you can sink!
13th Feb 2017, 9:50 AM
Ahri Fox
Ahri Fox - avatar
+ 2
ok a beginner can take it to be like decimals . . .
13th Feb 2017, 10:43 AM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar
+ 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
13th Feb 2017, 6:55 PM
Amaras A
Amaras A - avatar
0
division operation always gives a float
17th Feb 2017, 4:30 PM
Naveen
Naveen - avatar
0
k thanks @amaras
17th Feb 2017, 4:40 PM
Naveen
Naveen - avatar
0
rest or move on or near the surface of a liquid without sinking.
8th Mar 2017, 2:59 PM
Ronin Ashcroft
Ronin Ashcroft - avatar
- 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
17th Feb 2017, 4:19 PM
Amaras A
Amaras A - avatar
- 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.
17th Feb 2017, 4:17 PM
Naveen
Naveen - avatar
- 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
17th Feb 2017, 4:36 PM
Amaras A
Amaras A - avatar