]> pd.if.org Git - pdclib/blobdiff - functions/math/sqrt.c
Merged PDPCLIB and Therx code.
[pdclib] / functions / math / sqrt.c
index 3c6c1266f020b612c0e0c30efbedb2c1c5600ad1..9143170b1a85d882a0e1b4e71258f7ae9c759d0a 100644 (file)
@@ -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 */ };