All pastes #2132345 Raw Edit

swag

public c v1 · immutable
#2132345 ·published 2012-03-27 03:31 UTC
rendered paste body
#include <stdio.h>#define PRECISION 0.1float squareRootRecursiveGuess(float x, float g){    float cond, ans;    g=((x/g) + g)/2;    if((cond=x/g - g)>PRECISION || cond<-PRECISION)        return squareRootRecursiveGuess(x, g);    else    {           printf("squareroot() says: ans=%f\n", ans=g);        return ans;    }}int main(int argc, char** argv){    float sq=squareRootRecursiveGuess(28, 2);    printf("main() says: sq=%f\n", sq);    return 0;}