Check out example codes for "set precision with fixed c++". It will help you in understanding the concepts better.

Code Example 1

float x;
cout<<fixed<<showpoint;
cout<<setprecision(2) << x;

Code Example 2

int x = 109887;
cout << fixed << setprecision(3) << x;

Learn ReactJs, React Native from akashmittal.com