diff -urN povray-3.50c/src/torus.cpp povray-3.50c-ww/src/torus.cpp
--- povray-3.50c/src/torus.cpp	2003-01-07 02:08:29.000000000 +0100
+++ povray-3.50c-ww/src/torus.cpp	2003-08-03 11:55:43.000000000 +0200
@@ -255,7 +255,7 @@
   DBL c[5];
   DBL r[4];
   VECTOR P, D;
 
   Increase_Counter(stats[Ray_Torus_Tests]);
 
   /* Transform the ray into the torus space. */
@@ -286,10 +286,27 @@
 
   if (Test_Thick_Cylinder(P, D, y1, y2, r1, r2))
   {
+    DBL DistanceP; // Distance from P to torus center (origo).
+    DBL BoundingSphereRadius; // Sphere fully (amply) enclosing torus.
+    DBL Closer; // P is moved Closer*D closer to torus.
+	
 #ifdef TORUS_EXTRA_STATS
     Increase_Counter(stats[Torus_Bound_Tests_Succeeded]);
 #endif
 
+    // Move P close to bounding sphere to have more precise root calculation.
+    // Bounding sphere radius is R + r, we add r once more to ensure
+    // that P is safely outside sphere.
+    BoundingSphereRadius = Torus->R + Torus->r + Torus->r;
+    DistanceP = VSumSqr(P); // Distance is currently squared.
+    Closer = 0.0;
+    if (DistanceP > Sqr(BoundingSphereRadius))
+    {
+      DistanceP = sqrt(DistanceP); // Now real distance.
+      Closer = DistanceP - BoundingSphereRadius;
+      VAddScaledEq(P, Closer, D);
+    }
+
     R2   = Sqr(Torus->R);
     r2   = Sqr(Torus->r);
 
@@ -314,7 +331,8 @@
 
     while(n--)
     {
-      Depth[i++] = r[n] / len;
+      //Depth[i++] = r[n] / len;
+	  Depth[i++] = (r[n] + Closer) / len;
     }
   }
 

