I want to show only two decimal places from long double without rounding.
Example:
14.999999 => 14.99
12.501 => 12.50
12.505 => 12.50
There is a problem with some values.
For example this:
Excepted 204969/340 = 602.85
My result 204969/340 = 602.84
Code sample:
long long a = 204969;
long long b = 340;
long double final_result = (long double) a / (long double) b;
final_result = ((long long)(final_result * 100) / 100.00);
cout << fixed << setprecision(2) <<final_result;
Why?