X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fmath%2Fsqrt.c;h=9143170b1a85d882a0e1b4e71258f7ae9c759d0a;hp=3c6c1266f020b612c0e0c30efbedb2c1c5600ad1;hb=0a5395faab237ba9008352b0f4bee9659bbd3d5f;hpb=34893ecc2200dc7017c36a54cb6c5f4c2378b5ec 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 */ };