Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double a = 6.352356663353535;
- double b = a.precision(5);
- double a = 6.352356663353535;
- std::cout.precision(5);
- std::cout << a << std::endl;
- #include <cmath>
- #include <cstdio>
- using namespace std;
- int main()
- {
- double a = 6.352356663353535;
- double intpart;
- double fractpart = modf (a, &intpart);
- fractpart = roundf(fractpart * 100000.0)/100000.0; // Round to 5 decimal places
- double b = intpart + fractpart;
- printf("%.5lf", b);
- }
- 6.35236
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement