RRootEquinox
AI coding workspace

Stable quadratic roots

Two algebraically equal formulas can behave differently in floating point. RootEquinox brings coefficient fixtures and quadratic code into an AI conversation that supports checking a proposed numerical change.

● ● ●RootEquinox●
A concrete starting point · Stable quadratic roots ×
from math import isfinite, sqrt, copysign
def real_roots(a, b, c):
    original = (a, b, c)
    if not all(type(v) in (int, float) and isfinite(v) for v in original) or a == 0:
        raise ValueError("finite quadratic coefficients")
    if c == 0:
        other = -b / a
        if not isfinite(other) or (b != 0 and other == 0):
            raise ValueError("unrepresentable root")
        return [0.0] if b == 0 else sorted((0.0, other))
    scale = max(map(abs, original))
    a, b, c = (v / scale for v in original)
    if any(v != 0 and s == 0 for v, s in zip(original, (a,b,c))):
        raise ValueError("coefficient underflow")
    d = b*b - 4*a*c
    if d < 0: return []
    if d == 0: roots = [-b / (2*a)]
    else:
        q = -0.5 * (b + copysign(sqrt(d), b))
        if q == 0: raise ValueError("root underflow")
        roots = sorted((q/a, c/q))
    if not all(map(isfinite, roots)) or (original[2] != 0 and 0 in roots):
        raise ValueError("unrepresentable roots")
    return roots
✳Compute real roots of a quadratic using scaled coefficients and a cancellation-resistant formula.
✓ ChangesReview before applying ↗
Illustrative workspace
  1. Connection

    Base URL, credentials and a reachable server.

  2. Project

    Test a repeated root and widely separated roots, rejecting a zero leading coefficient or unrepresentable results and returning no roots for a negative discriminant.

  3. Review before applying

    Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

Workflows

Stable quadratic roots

Workflows ↗
A concrete starting point
from math import isfinite, sqrt, copysign
def real_roots(a, b, c):
    original = (a, b, c)
    if not all(type(v) in (int, float) and isfinite(v) for v in original) or a == 0:
        raise ValueError("finite quadratic coefficients")
    if c == 0:
        other = -b / a
        if not isfinite(other) or (b != 0 and other == 0):
            raise ValueError("unrepresentable root")
        return [0.0] if b == 0 else sorted((0.0, other))
    scale = max(map(abs, original))
    a, b, c = (v / scale for v in original)
    if any(v != 0 and s == 0 for v, s in zip(original, (a,b,c))):
        raise ValueError("coefficient underflow")
    d = b*b - 4*a*c
    if d < 0: return []
    if d == 0: roots = [-b / (2*a)]
    else:
        q = -0.5 * (b + copysign(sqrt(d), b))
        if q == 0: raise ValueError("root underflow")
        roots = sorted((q/a, c/q))
    if not all(map(isfinite, roots)) or (original[2] != 0 and 0 in roots):
        raise ValueError("unrepresentable roots")
    return roots
AI coding workspace

Review numerical behavior beyond the ordinary case

RootEquinox is a Windows AI coding workspace for developers who need to examine how a numerical implementation behaves outside its comfortable examples. Start with your project files and describe the range of inputs the application expects. Ask the connected model to inspect both the calculation and the caller's response when a result cannot be represented as intended.

A quadratic-root routine provides one concrete task. Widely separated coefficients can expose behavior that a small classroom example misses, so bring representative fixtures into the conversation before requesting an edit. Discuss repeated roots, rejected leading coefficients and how the function reports an unsupported result. These questions connect a proposed formula change to the software contract surrounding it.

Inspect the resulting source and run project checks using the original fixtures, including residual checks where appropriate. Avoid treating a plausible displayed number as sufficient evidence that the implementation meets its bounds. RootEquinox works with supported OpenAI-compatible or Anthropic endpoints, using credentials when required. An unrestricted model is an option where the configured service supplies one, while tools and context limits depend on the server. The aim is a numerical change you can assess against explicit cases, with rejection behavior reviewed as carefully as successful output.

Assessing a numerical patch

What should accompany a reported inaccurate result?

Provide the input coefficients, expected behavior and enough detail to reproduce the discrepancy. Include how the caller uses the result. That gives the assistant a concrete software problem instead of an invitation to replace the formula without evidence.

Why inspect rejection paths in numerical code?

Callers need a defined response when input is invalid or a useful result cannot be represented. Review those paths with the calculation so a patch does not replace a clear failure with misleading output or an unexpected exception.

Can a residual check prove every root is accurate?

It contributes evidence about the returned values but is not a universal proof. Use it with reference cases and input-boundary checks, and review the tolerance assumptions rather than accepting a single small residual as a complete validation.

Should I accept a rewrite that passes ordinary examples?

Only after checking the difficult cases that motivated the task. Preserve widely separated scales, repeated roots and specified invalid inputs in the project tests. Review any changed failure behavior before accepting the replacement.

Get the Windows app ↗

RootEquinox · Updated 2026-10-25