fork(1) download
  1. #include <cmath>
  2. #include <limits>
  3. #include <iomanip>
  4. #include <iostream>
  5. #include <type_traits>
  6. #include <algorithm>
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. cout<<std::numeric_limits<float>::min()<<endl;
  12.  
  13. float d1 = 1.000000000f;
  14. // epsilon 0.00000011920928955078125;
  15. float d2 = 1.0000001192092895f;
  16. cout << fabs(d1 - d2)<<endl;
  17. if ((d2 - d1) < std::numeric_limits<float>::epsilon())
  18. {
  19. cout<<"same"<<endl;
  20. }
  21. if ((d2 - d1) == std::numeric_limits<float>::epsilon())
  22. {
  23. cout<<"==same"<<endl;
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
1.17549e-38
1.19209e-07
==same