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)); } }
相关文章
- pytorch 1.7训练保存的模型在1.4低版本无法加载:frame #63: <unknown function> + 0x1db3e0 (0x55ba98ddd3e0 in /data/user
- 用迭代法求 x=根号a。求平方根的迭代公式为:X(n+1)=(Xn+a/Xn) /2。要求前后两次求出的x的差的绝对值 小于10的-5次方
- 练习:用迭代法求x=√a。要求前后两次求出的x的差的绝对值小于10^-5
- 求X的平方根
- 很多人咨询的问题intel至强e5-2680和I5\i7、L5630X2有什么区别?
- 习题5-7 使用函数求余弦函数的近似值 (15 分)
- 无法加载 DLL“”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)
- 高数(求x的n次方的导数)
- 算法导论-求x的n次方
- C语言:求e的值。 e=1+1/1! +1/2! +1/3! ...+1/n!(for循环)