When I use long double
I get worse precision than using double
.
3.14159265358979323846264L
is this good to write long double const
in source code or I should add something other than L
?
EDIT I solved the problem. I change algorithm to be more precisely.
Your are not getting a worse precision.
What is happening is that when you print the number out the stream library is truncating the displayed value. Use std::setprecision to get a specific precision.