C++ – What’s the difference between LONG float and double in C++

cdoublefloating point

So I know that there's a large difference in the precision of floats and doubles. I get that. Promise.

But, in C++, when calling scanf and printf, the notation used to specify a double is "%lf", and that stands for long float, right? So while a float is less precise than a double, a LONG float (presumedly called long float because it can be "longer" by having more terms) is the same accuracy and therefore essentially the same thing?

Just to clarify, here's what I mean:

double number = 3.14159;
printf("The number is %lf", number);

So the root of my question: Is long float another name for double?

Best Answer

There is no such a type as long float within my knowledge.

This post gives you information about why people use lf to print double with printf if this is the cause of your confusion.

By courtesy of @Jerry Coffin:

"%f" is the (or at least "a") correct format for a double. There is no format for a float, because if you attempt to pass a float to printf, it'll be promoted to double before printf receives it. "%lf" is also acceptable under the current standard -- the l is specified as having no effect if followed by the f conversion specifier (among others).

So the reason is that when people do:

 printf("The number is %lf", number);

It is equivalent to do:

printf("The number is %f", number); //l has no effect when printing double