fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. double ang = M_PI;
  7. double rd = sin(ang);
  8. float rdf = (float) rd;
  9. float rff = sin((float) ang);
  10. cout << " sin(2pi ): " << rd << endl;
  11. cout << "(float) sin(2pi ): " << rdf << endl;
  12. cout << "(float) sin((float)2pi): " << rff << endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
        sin(2pi       ): 1.22465e-16
(float) sin(2pi       ): 1.22465e-16
(float) sin((float)2pi): -8.74228e-08