fork(3) download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main(void) {
  5. double x = 3.0;
  6. double low = 1.0;
  7. double high = x;
  8. while(fabs(low-high) > 0.0000001) {
  9. double mid = (high+low)/2.0;
  10. if(mid*mid*mid > x)
  11. high = mid;
  12. else
  13. low = mid;
  14. }
  15. printf("%.6lf", low);
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
1.442250