What Is The Main Difference Between Float And Double Data Types?

Write your question here.
Nowadays I am learning Data types in Cpp, and a little bit confused about the Data types, Apart from the memory size of both data types,I want to know any other differences and also want to know when we use float and when we use double???
The memory size determines the precision that the numbers can represent. doubles have double the precision of 32-bit floats. Both are discrete approximations of the real numbers, but doubles are denser than floats.

You should prefer double unless you have a specific reason not to. It is the default type that C++ uses when you write a number like "3.4". (3.4f would be the float variant)

Some particular reasons to not use double may be that you are interfacing with a particular API that expects floats; for example, OpenGL traditionally works with floats for most of its calls, and the graphics processor doesn't always support doubles (and even if it does, it may be overkill for graphics).
Thanks for the reply I found this(https://www.techgeekbuzz.com/float-vs-double/) this helps me a lot to understand the Float and Double data types.
thanks a lot
Registered users can post here. Sign in or register to post.