X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fmath%2Fsqrt.c;h=9143170b1a85d882a0e1b4e71258f7ae9c759d0a;hb=e5456e3c2697c4e17fc9aa3439f2e305517b4d96;hp=3c6c1266f020b612c0e0c30efbedb2c1c5600ad1;hpb=dcc8a8e99f69e090a03b7b868443addbc0817820;p=pdclib.old diff --git a/functions/math/sqrt.c b/functions/math/sqrt.c index 3c6c126..9143170 100644 --- a/functions/math/sqrt.c +++ b/functions/math/sqrt.c @@ -15,5 +15,22 @@ long double sqrt( long double x ) { /* TODO */ }; // Standard C double sqrt( double x ) { /* TODO */ }; + +/* Therx code +{ + double i = x / 2; + if ( x < 0 ) + { + return 0; + } + // (15 DP) HOW GET MORE? + while ( ( fabs( i - ( x / i ) ) / i ) > 0.000000000000001) + { + i = ( i + ( x / i ) ) / 2; + } + return i; +} +*/ + float sqrtf( float x ) { /* TODO */ }; long double sqrtl( long double x ) { /* TODO */ };