fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8. double d_n = 28187281.525;
  9. double float_part = abs(d_n) - (int)abs((d_n)); //The target number is 28187281.525
  10. cout << setprecision(5) << float_part; // The result is 0.525
  11. cout << ((abs(d_n) - (int)abs((d_n))) == 0.525) ; //The result is 0
  12. return 0;
  13. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
0.5250