⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 francoisvieta.java

📁 Produce a Java program to calculate the value of π in two different methods proposed by Francois Vie
💻 JAVA
字号:
class FrancoisVieta extends Estimation
{
	//----------------FIELDS-------------
	private double pi;

	//--------------CONSTRUCTOR-------------
	public FrancoisVieta(int newTermNo)
	{
		super(newTermNo);
	}

	//-----------------METHOD----------------
	
	public double calc_pi()
	{
		double tempValue = 1.0;
		double dividend = 0.0;

		for (int i = 1; i <= termNo; i++)
		{
			dividend=Math.sqrt(2.0+dividend);
			tempValue=0.5*tempValue*dividend;
		}
		pi=2/tempValue;
		return(pi);
	}
}   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -