POV-Ray : Newsgroups : povray.programming : solving polynomials : solving polynomials Server Time
25 Apr 2024 01:26:37 EDT (-0400)
  solving polynomials  
From: robfi680
Date: 20 Oct 2016 03:40:00
Message: <web.580874a6f9e539ccf4af9d600@news.povray.org>
I was just looking at the source code for POVRay 3.7 for solving polynomials. In
the default case for Solve_Polynomial it looks to me like it solves the
polynomial twice for orders higher than four when a root is eliminated. I am
trying to understand the code for my own use. Could there be a break statement
missing ? Otherwise why does it solve for order n-1 and then n ?

The code looks like:
  default:

   if (epsilon > 0.0)
   {
    if ((c[n-1] != 0.0) && (fabs(c[n]/c[n-1]) < epsilon))
    {
     Thread->Stats()[Roots_Eliminated]++;

     roots = polysolve(n-1, c, r);
    }
   }

   /* Solve n-th order polynomial. */

   roots = polysolve(n, c, r);

   break;


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.