]> pd.if.org Git - pdclib/blobdiff - functions/math/sqrt.c
Introducing personalities. Removing C++ function decs / defs.
[pdclib] / functions / math / sqrt.c
index 3c6c1266f020b612c0e0c30efbedb2c1c5600ad1..7dd60203519089a8e5adc7e16a521813e14610ce 100644 (file)
@@ -5,15 +5,23 @@
 // This code is Public Domain. Use, modify, and redistribute at will.
 // ----------------------------------------------------------------------------
 
-// ----------------------------------------------------------------------------
-// C++
+double sqrt( double x ) { /* TODO */ };
 
-float sqrt( float x ) { /* TODO */ };
-long double sqrt( long 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;
+}
+*/
 
-// ----------------------------------------------------------------------------
-// Standard C
-
-double sqrt( double x ) { /* TODO */ };
 float sqrtf( float x ) { /* TODO */ };
 long double sqrtl( long double x ) { /* TODO */ };