quadratic_roots

std.elementwise.quadratic_roots · Level L1

The roots of a·x² + b·x + c = 0, a ≠ 0, elementwise, in the form that avoids cancellation: q = −(b + sign(b)·√D)/2 with D = b² − 4ac, then x₁ = q/a and x₂ = c/q. For D < 0 the roots are re ± i·im, with re₁ = re₂ = −b/(2a) and im = √(−D)/|2a|; for D ≥ 0, im = 0. The naive (−b ± √D)/(2a) loses the smaller root to cancellation when b² ≫ |4ac|.

q = −(b + sgn(b)√D)/2, x₁ = q/a, x₂ = c/q

Signature

quadratic_roots(a: f64[n], b: f64[n], c: f64[n]) → f64[n], f64[n], f64[n]

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

af64[n]2.0bf64[n]0.0cf64[n]1.0Multiplya2NegatenbMultiplybbMultiplyac4.0LessbnegNegatemoneNegatena2DividereMultiplyac4WheresgnMaximumabs_a2SubtractDLesscomplexNegatenDMaximumabsDSqrtsDivideimvMultiplyssWhereimAddbsNegatenbsDivideqDividex1EqualqzWherere1WhereqsDividecqWherex2Wherere2re1f64[n]imf64[n]re2f64[n]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Agrees with the reference (−b ∓ sgn(b)√D)/(2a) for D ≥ 0; −b/(2a) ± i√(−D)/|2a| for D < 0 to 80 digits (100-digit arithmetic), on all 40 test cases.
  • All 447 float64 results inside the running error bound; the closest uses 79% of it.
  • Interpreter and NumPy backend return bit-identical results.
  • At float32 too: the 40 test cases rounded to float32, and 40 of them inside the running error bound at u = 2⁻²⁴; the closest uses 87% of it.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
84%
bit-equal to the NumPy formula in float64
77%
largest error, in units in the last place
4.79

Note

Whether D < 0 is a decision. Near a double root D is close to 0, and whether the roots are real or complex is not certain; such a case is uncertified, which is the problem's own ill-conditioning. The verification takes c ≠ 0, which keeps q away from 0. For b = c = 0 (a·x² = 0) NOVA returns 0 and 0, but the oracle's floor on the error of √0 leaves q = 0 uncertain, so that case is not certified.

Identity

Calls
—
Called by
sha256:ea197342096e22f2538c7d76ea171134321611ebf8fc1e0469e271f91e5b9c12

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.

Control handle

Symbol
Ω:std.elementwise.quadratic_roots · Ω:quadratic_roots
Pins
sha256:80aff3dc7b8864fdb70d6511f4675fb26ab887086d092bedd95725335105ee53this graph alone
Evidence
sha256:1e26112dd42fe38ca4cb5bb11c079a941335ac629ea2fc3a59de78ab4b556b72the hash of its verification record
Needs
no capability: a pure function

Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.

ΣEML 2026

Efficient New Language — a high-density semantic overlay for humans and AI agents.

This site’s demos run on the real EML toolchain, in your browser.

© 2026 EveMissLab (一言諾科技有限公司) / Neo.K. All rights reserved.