I'm not going to go into length about what the program does, as thats not the fix i want. The fix I want is that it only ever outputs is 3.0... it seems to round everything up and down, despite me never telling it to.

Any ideas?

Code:
import java.util.*;
import java.math.*;

public class pi{
	public static void main (String[]args){
	
	double pi=0;
	double fraction=0;
	String mathfunction;
	int funccounter=0;
	int denominator=0;
	int loopcounter=0;
	
	pi=4;
	denominator=1;
	while (pi!=3.1415926)
	{
		if (loopcounter==0)
		{
			fraction=1-1/3;
		}
		else
		{
			fraction=1/denominator;
		}
		denominator=denominator+2;
		if (funccounter % 2==0)
		{
			pi=pi-fraction;
		}
		else
		{
			pi=pi+fraction;
		
		}
		System.out.println(pi);
		if ((pi==3.14||pi==3.14159||pi==3.1415926))
		{
			System.out.println("Pi was equal to "+pi+" on the "+ loopcounter+ " st/nd/th loop");
		}
		loopcounter++;	
		funccounter++;
		
		
	}
	}
		
}