#include #include struct valores{ float termo; // i-esimo termo double invsqrt; // valor calculado via InvSqrt double mathsqrt; // valor calculado via 1/Math.sqrt(x) double delta; // abs(invsqrt - mathsqrt), erro entre a aproximacao e o valor real } typedef Valores; const int QUANTIDADETESTADA = 100000; float InvSqrt (float x) { float xhalf = 0.5f*x; int i = *(int*)&x; i = 0x5f3759df - (i>>1); x = *(float*)&i; x = x*(1.5f - xhalf*x*x); return x; } int main(void){ Valores vars[QUANTIDADETESTADA]; float termos = 0.f; for(int i=0; i