Skip to content

Normalize the Sturm chain entries so high degrees survive f32 #295

Open

Description

@kmolan

What: root_counting_chain builds each entry as the negated remainder of the two before it,
with no rescaling, so the coefficients grow or shrink geometrically down the chain. By degree ten
the later entries overflow to infinity in f32 and underflow to zero in both precisions, and since
sign_changes skips exact zeros and reads signs off the rest, count_real_roots and
real_roots_in then miscount silently. Only the signs matter, so normalizing each entry to unit
max-norm as it is built costs one pass and removes the failure entirely.

Where: crates/multicalc/src/polynomial/roots.rs.

How to test: cargo test -p multicalc; assert a degree-12 polynomial with known real roots is
counted correctly at both f32 and f64, which fails today at the higher degrees.

Activity

  1. added
    bugSomething isn't working
    help wantedExtra attention is needed
    optimizationRoot finding, least squares, manifold optimization
    no_stdKeeps the default no_std, no-alloc core
    accuracyNumerical-accuracy focus
    on Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accuracyNumerical-accuracy focusbugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is neededno_stdKeeps the default no_std, no-alloc coreoptimizationRoot finding, least squares, manifold optimization

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions