fork download
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main () {
  7. cout << "(4) ^ (2.1) = " << pow (4, -2.1) << endl; // 0.0544094
  8. cout << "(-4) ^ (-2.1) = " << pow (-4, -2.1) << endl; // -nan
  9. cout << "(-4) ^ (2.1) = " << pow (-4, 2.1) << endl; // -nan
  10. return 0;
  11. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
(4)  ^ (2.1)  = 0.0544094
(-4) ^ (-2.1) = -nan
(-4) ^ (2.1)  = -nan