阅读背景:

求e^x的近似值

来源:互联网 
package com.test.common;

public class TestE {

	public static double getE(int x)
	{
		int ncount=1;
		int xcount=x;
		double count=1;
		
		int n=1;
		
		while(n<10)
		{
			ncount=ncount*n;
			xcount=xcount*x;
			count+=(double)xcount/(double)ncount;
			
			n++;
		}
		
		return count;
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println(getE(2));
	}

}
package com.test.common;

public class TestE {



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: