Floats | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Floats

What does floats mean actually? Can anyone please explain with an example??

13th Jan 2021, 10:20 AM
Harshitha R
Harshitha R  - avatar
7 Answers
+ 7
Harshitha R 10B Yes 7 can be considered as float also. Similar to how it is both integer as well as a real number in maths. But by default compiler will consider it as integer as it takes up less space compared to floats. If you want, you can tell your program to treat it as float (method might vary for different programming languages) But making it 7.0 should work for most. https://code.sololearn.com/cyBfge34gMQW/?ref=app
13th Jan 2021, 10:34 AM
Arsenic
Arsenic - avatar
+ 5
Simple explanation : numbers having decimal points are called float ...
13th Jan 2021, 10:29 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 5
No 7 is not a Float .but 7.0 is ...
13th Jan 2021, 10:30 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 3
It's simple! Float is a shortened term for "floating point." By definition, it's a fundamental data type built into the compiler that's used to define numeric values with floating decimal points. C, C++, C# and many other programming languages recognize float as a data type. Other common data types include int and double. Example of float - 3.45f , 8.85 , 0.04 etc. NOTE : 7 is also written as 7.0 in float All the best!
13th Jan 2021, 1:34 PM
Abhiyantā
Abhiyantā - avatar
+ 2
Floats are used to represent/store any real number in a variable For example 2.1242 3.14 3.00 5.0001 And much more.
13th Jan 2021, 10:26 AM
Arsenic
Arsenic - avatar
+ 1
7 👆is this a float?
13th Jan 2021, 10:29 AM
Harshitha R
Harshitha R  - avatar