cbrt_bisect

std.seq.cbrt_bisect · Level L3

∛a by bisection: start from the bracket ±(|a| + 1), which always contains the root, and halve it until it is narrower than 10⁻¹²·(|a| + 1). A While whose state is the bracket itself.

[lo, hi] ← bisect while hi − lo > 10⁻¹²·(|a| + 1)

Signature

cbrt_bisect(a: f64[]) → f64[]

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[]NegatenaMaximumabs_a1.0AddrNegatenrReshapehi0Reshapelo0ConcatstartWhile·bisect_cube_stepbracketReduceSumtotal0.5Multiplyrootrootf64[]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Equal to the reference bisection on [-(|a|+1), |a|+1] until narrower than 1e-12*(|a|+1) in exact rational arithmetic, on all 40 test cases.
  • All 40 float64 results inside the running error bound; the closest uses 7% of it.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
60%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
2.51

Identity

sha256:565528e111a4857c83f14293a79a9a77091445beadb06eaab04edd99a10b467a

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