fork download
  1. #include <math.h>
  2. #include <stdio.h>
  3.  
  4. int ipow(double base, double exp) {
  5. double res = pow(base, exp);
  6. return *(int*)((void*)&res);
  7. }
  8.  
  9. int main(void) {
  10. for (int n = 1; n < 6; n++) {
  11. double x = 20 * pow(2.0, ((1-n)/5.0));
  12. double y = 20 * ipow(2.0, ((1-n)/5.0));
  13. printf("n=%d, x=%f, y=%f\n", n, x, y);
  14. }
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 4516KB
stdin
Standard input is empty
stdout
n=1, x=20.000000, y=0.000000
n=2, x=17.411011, y=422418048.000000
n=3, x=15.157166, y=1240833840.000000
n=4, x=13.195079, y=-1971682192.000000
n=5, x=11.486984, y=-2036727536.000000