A familiar algebraic formula can give an inaccurate numerical answer even when the mathematical problem has two well-separated roots. The standard quadratic expression forms one root by subtracting numbers that may be almost equal. Small errors already present in those numbers can then dominate their tiny difference. Rewriting the same exact equation can preserve information that the original evaluation order discards.
For robot numerical-model work, this is an algorithm question: keep the same coefficients and change how their roots are computed. The following teaching calculation declares a small decimal working precision to expose the mechanism. It is not a measured robot error, a claim about every floating-point implementation, or a report from a root-solving package.
Specify the equation and arithmetic
Let a x squared + b x + c = 0, with a nonzero. For the main example choose a = 1, b = 700, and c = 1. All three coefficients are dimensionless and exact in this invented problem. The discriminant D = b squared - 4ac is exactly 489996.
The two exact roots are [-700 plus or minus sqrt(489996)]/2. A high-precision reference evaluation gives the larger-magnitude root approximately -699.998571425656 and the smaller-magnitude root approximately -0.001428574344035. Their product is c/a = 1 and their sum is -b/a = -700.
Now declare decimal arithmetic rounded to four significant digits after each operation, using ordinary nearest rounding. This is a simplified numerical model, not a description of binary32 or binary64. The chosen numbers do not depend on a rounding tie.
Follow the cancellation branch
The product b squared is 490000. Subtracting 4 produces 489996 before rounding, but four significant digits round it back to 490000. Its square root becomes 700 in the declared working arithmetic. The small-root numerator -700 + 700 is then zero, and division by two returns zero.
The true small root is nonzero. The resulting relative error is one, or 100 percent. The subtraction can be exactly evaluated for its already-rounded operands and still give a useless answer: it cannot recover the discriminant information lost earlier. The important observation is where the approximation becomes large relative to the final quantity.
The other sign gives (-700 - 700)/2 = -700. It is close to the true large root in relative terms. One algebraic formula has therefore treated the two roots very differently, even though both came from the same discriminant and input coefficients.
The authored ALAFF text explains this cancellation mechanism and rationalization. Michael Heath's University of Illinois module separately discusses finite-precision sign patterns and range problems. The equation, arithmetic precision, and error comparison here are newly constructed rather than copied from their examples.
Recover the small root through a product
Since the root product is c/a, first compute the large root through the noncanceling sign. With the four-digit result R = -700, obtain the other root as (c/a)/R. Rounding that division to four significant digits gives -0.001429.
That answer has about 0.0298 percent relative error against the high-precision small root. It is a substantial improvement over zero, although it is not exact. The method avoids using the small difference of the two large approximate quantities as the main source of the answer.
Rationalization shows the same relationship directly. For the small root in this example, multiply (-b + sqrt(D))/(2a) by (-b - sqrt(D))/(-b - sqrt(D)). The numerator simplifies to b squared - D = 4ac, giving 2c/[-b - sqrt(D)]. Its denominator adds two negative terms rather than canceling them.
A sign-aware form for both roots
For real coefficients with D nonnegative, define q = -[b + sign(b) sqrt(D)]/2, choosing sign(0) as +1 for this convention. The term in brackets adds quantities with the same sign when b is nonzero. The roots can then be formed as q/a and c/q, provided q is nonzero.
When b is positive, q selects the negative large-magnitude branch. When b is negative, it selects the positive one. The purpose of the sign choice is numerical: the two equivalent expressions should not both be evaluated through their potentially canceling branches and trusted indiscriminately.
Special cases remain part of the algorithm. If a is zero, the equation is no longer quadratic. If c is zero, its roots can be handled directly as zero and -b/a. If both b and c are zero, q is zero and c/q is not a valid recovery step. Negative discriminants require complex-root handling outside the real-valued calculation used here.
What this rewrite does and does not fix
The discriminant can itself involve cancellation when b squared is close to 4ac. That is a separate issue from subtracting b and sqrt(D) in a root numerator. Near a repeated root, the roots can also be sensitive to small changes in coefficients. A stable evaluation order does not eliminate sensitivity inherent in the specified input problem.
Likewise, forming b squared may overflow, or tiny products may underflow, in an arithmetic format with finite exponent range. A sign-aware numerator alone is not a complete general-purpose root solver. Scaling, discriminant evaluation, special cases, and the allowed coefficient domain need separate treatment.
For this example the two roots are far apart and the coefficient range is benign. The deliberately low working precision isolates one avoidable arithmetic failure. Its lesson is precise: exact algebraic equivalence does not imply equal numerical behavior after intermediate rounding. Keeping the coefficients, evaluation order, rounding model, and root identities together makes the difference reproducible without turning it into an unsupported statement about robot accuracy.
Sources checked October 24, 2026:
ALAFF: Catastrophic cancellation: https://www.cs.utexas.edu/~flame/laff/alaff/a2appendix-catastrophic-cancellation.html
Michael Heath: Quadratic Formula module: https://heath.web.engr.illinois.edu/iem/floating_point/quadratic_formula/
Image caption: Concept illustration from the site media library. Robot beside laptop displaying workflow; conceptual data preparation context. The scene does not depict this article's mathematical inputs, a hardware experiment, or a measured result.