x的x次幂的值为10,求x的近似值

public class Main {  
    static double eps = 1e-7;  
    public static void main(String[] args){  
        double l = 2,r = 3,mid;  
        while(l+eps < r){  
            mid = (l+r)/2;  
            if(Math.pow(mid,mid) < 10)  
                l = mid;  
            else  
                r = mid;  
        }  
        System.out.printf("%.6f\n",l);  
    }  
} 

 

posted @ 2017-04-05 20:42  卡洛小豆  阅读(851)  评论(0编辑  收藏  举报