strictfp public class InvSqrtxT { static final double TEMPOEXECUCAO = 3600; public static void main(String[] args) { double serie = 0.f; // criterio de comparacao long termosPorSegundo = 0l; // contador de termos gerados float i=1.f; // i-esimo termo double tStart, tActual,t,told; // tempo, em milisegundos tStart = (double)System.currentTimeMillis()/1000; tActual = (double)System.currentTimeMillis()/1000; t=(tActual - tStart); told=t; while( t < TEMPOEXECUCAO){ InvSqrt(i++); if(told == t-1){ System.out.println(t+"\t"+termosPorSegundo); termosPorSegundo = 0; told = t; }else{ t=(tActual - tStart); termosPorSegundo++; } tActual = (double)System.currentTimeMillis()/1000; } } strictfp static float InvSqrt(float x){ float xhalf = 0.5f * x; int i = Float.floatToRawIntBits(x); // converte para inteiro mantendo a representacao ieee 754 i = 0x5f3759df - (i >> 1); // a tal operacao x = Float.intBitsToFloat(i); x = x * (1.5f - xhalf * x * x); return x; } }