Java Code:
public class CalInfiniteSeries implements ActionListener
	{
		public void actionPerformed(ActionEvent event)
		{	
			int inputNum; 
			double calSeries;
			String text = firstField.getText();
			inputNum = Integer.parseInt(text);
			for(int n=0;n<=1000;n++)
				{calSeries = (Math.pow(-1,n))/(n+1.0);}
			
			thirdField.setText(Double.toString(calSeries));    
		}
	}
It stated that the precision is wrong.
How should I corrected it?