Average Error: 28.8 → 5.0
Time: 17.1s
Precision: binary64
Cost: 60804
\[\left(\left(1.0536712127723509 \cdot 10^{-8} < a \land a < 94906265.62425156\right) \land \left(1.0536712127723509 \cdot 10^{-8} < b \land b < 94906265.62425156\right)\right) \land \left(1.0536712127723509 \cdot 10^{-8} < c \land c < 94906265.62425156\right)\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
\[\begin{array}{l} t_0 := c \cdot \left(a \cdot -3\right)\\ t_1 := \mathsf{fma}\left(b, b, t_0\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + t_0} - b}{3 \cdot a} \leq -1:\\ \;\;\;\;\frac{\frac{t_1 - b \cdot b}{b + \sqrt{t_1}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5625, \left(a \cdot a\right) \cdot \frac{{c}^{3}}{{b}^{5}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, a \cdot \frac{c \cdot c}{{b}^{3}}, \frac{{\left(a \cdot c\right)}^{4}}{{b}^{7}} \cdot \frac{-1.0546875}{a}\right)\right)\right)\\ \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* c (* a -3.0))) (t_1 (fma b b t_0)))
   (if (<= (/ (- (sqrt (+ (* b b) t_0)) b) (* 3.0 a)) -1.0)
     (/ (/ (- t_1 (* b b)) (+ b (sqrt t_1))) (* 3.0 a))
     (fma
      -0.5625
      (* (* a a) (/ (pow c 3.0) (pow b 5.0)))
      (fma
       -0.5
       (/ c b)
       (fma
        -0.375
        (* a (/ (* c c) (pow b 3.0)))
        (* (/ (pow (* a c) 4.0) (pow b 7.0)) (/ -1.0546875 a))))))))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
double code(double a, double b, double c) {
	double t_0 = c * (a * -3.0);
	double t_1 = fma(b, b, t_0);
	double tmp;
	if (((sqrt(((b * b) + t_0)) - b) / (3.0 * a)) <= -1.0) {
		tmp = ((t_1 - (b * b)) / (b + sqrt(t_1))) / (3.0 * a);
	} else {
		tmp = fma(-0.5625, ((a * a) * (pow(c, 3.0) / pow(b, 5.0))), fma(-0.5, (c / b), fma(-0.375, (a * ((c * c) / pow(b, 3.0))), ((pow((a * c), 4.0) / pow(b, 7.0)) * (-1.0546875 / a)))));
	}
	return tmp;
}
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a))
end
function code(a, b, c)
	t_0 = Float64(c * Float64(a * -3.0))
	t_1 = fma(b, b, t_0)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) + t_0)) - b) / Float64(3.0 * a)) <= -1.0)
		tmp = Float64(Float64(Float64(t_1 - Float64(b * b)) / Float64(b + sqrt(t_1))) / Float64(3.0 * a));
	else
		tmp = fma(-0.5625, Float64(Float64(a * a) * Float64((c ^ 3.0) / (b ^ 5.0))), fma(-0.5, Float64(c / b), fma(-0.375, Float64(a * Float64(Float64(c * c) / (b ^ 3.0))), Float64(Float64((Float64(a * c) ^ 4.0) / (b ^ 7.0)) * Float64(-1.0546875 / a)))));
	end
	return tmp
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(b * b + t$95$0), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], -1.0], N[(N[(N[(t$95$1 - N[(b * b), $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(-0.5625 * N[(N[(a * a), $MachinePrecision] * N[(N[Power[c, 3.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision] + N[(-0.375 * N[(a * N[(N[(c * c), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[N[(a * c), $MachinePrecision], 4.0], $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision] * N[(-1.0546875 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\begin{array}{l}
t_0 := c \cdot \left(a \cdot -3\right)\\
t_1 := \mathsf{fma}\left(b, b, t_0\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b + t_0} - b}{3 \cdot a} \leq -1:\\
\;\;\;\;\frac{\frac{t_1 - b \cdot b}{b + \sqrt{t_1}}}{3 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5625, \left(a \cdot a\right) \cdot \frac{{c}^{3}}{{b}^{5}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, a \cdot \frac{c \cdot c}{{b}^{3}}, \frac{{\left(a \cdot c\right)}^{4}}{{b}^{7}} \cdot \frac{-1.0546875}{a}\right)\right)\right)\\


\end{array}

Error

Derivation

  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)) < -1

    1. Initial program 10.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Applied egg-rr11.0

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\frac{{b}^{4} - \left(c \cdot \left(a \cdot -3\right)\right) \cdot \left(c \cdot \left(a \cdot -3\right)\right)}{b \cdot b - c \cdot \left(a \cdot -3\right)}}}}{3 \cdot a} \]
    3. Applied egg-rr10.1

      \[\leadsto \frac{\color{blue}{\frac{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) - b \cdot b}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}}}}{3 \cdot a} \]

    if -1 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a))

    1. Initial program 31.8

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around inf 4.1

      \[\leadsto \color{blue}{-0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.16666666666666666 \cdot \frac{{\left(-1.125 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 5.0625 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right)} \]
    3. Simplified4.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5625, \left(a \cdot a\right) \cdot \frac{{c}^{3}}{{b}^{5}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, a \cdot \frac{c \cdot c}{{b}^{3}}, \frac{\left(\left({c}^{4} \cdot {a}^{4}\right) \cdot 6.328125\right) \cdot -0.16666666666666666}{a \cdot {b}^{7}}\right)\right)\right)} \]
      Proof
      (fma.f64 -9/16 (*.f64 (*.f64 a a) (/.f64 (pow.f64 c 3) (pow.f64 b 5))) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (*.f64 a (/.f64 (*.f64 c c) (pow.f64 b 3))) (/.f64 (*.f64 (*.f64 (*.f64 (pow.f64 c 4) (pow.f64 a 4)) 405/64) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 a 2)) (/.f64 (pow.f64 c 3) (pow.f64 b 5))) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (*.f64 a (/.f64 (*.f64 c c) (pow.f64 b 3))) (/.f64 (*.f64 (*.f64 (*.f64 (pow.f64 c 4) (pow.f64 a 4)) 405/64) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 (pow.f64 c 3) (pow.f64 b 5)) (pow.f64 a 2))) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (*.f64 a (/.f64 (*.f64 c c) (pow.f64 b 3))) (/.f64 (*.f64 (*.f64 (*.f64 (pow.f64 c 4) (pow.f64 a 4)) 405/64) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5))) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (*.f64 a (/.f64 (*.f64 c c) (pow.f64 b 3))) (/.f64 (*.f64 (*.f64 (*.f64 (pow.f64 c 4) (pow.f64 a 4)) 405/64) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (*.f64 a (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 c 2)) (pow.f64 b 3))) (/.f64 (*.f64 (*.f64 (*.f64 (pow.f64 c 4) (pow.f64 a 4)) 405/64) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 (pow.f64 c 2) (pow.f64 b 3)) a)) (/.f64 (*.f64 (*.f64 (*.f64 (pow.f64 c 4) (pow.f64 a 4)) 405/64) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3))) (/.f64 (*.f64 (*.f64 (*.f64 (pow.f64 c 4) (pow.f64 a 4)) 405/64) -1/6) (*.f64 a (pow.f64 b 7)))))): 1 points increase in error, 1 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (/.f64 (*.f64 (*.f64 (*.f64 (pow.f64 c 4) (pow.f64 a 4)) (Rewrite<= metadata-eval (+.f64 81/64 81/16))) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (/.f64 (*.f64 (*.f64 (*.f64 (pow.f64 c 4) (pow.f64 a 4)) (+.f64 (Rewrite<= metadata-eval (*.f64 -9/8 -9/8)) 81/16)) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (/.f64 (*.f64 (Rewrite<= distribute-rgt-out_binary64 (+.f64 (*.f64 (*.f64 -9/8 -9/8) (*.f64 (pow.f64 c 4) (pow.f64 a 4))) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4))))) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 1 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (/.f64 (*.f64 (+.f64 (*.f64 (*.f64 -9/8 -9/8) (*.f64 (pow.f64 c (Rewrite<= metadata-eval (*.f64 2 2))) (pow.f64 a 4))) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (/.f64 (*.f64 (+.f64 (*.f64 (*.f64 -9/8 -9/8) (*.f64 (Rewrite<= pow-sqr_binary64 (*.f64 (pow.f64 c 2) (pow.f64 c 2))) (pow.f64 a 4))) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (/.f64 (*.f64 (+.f64 (*.f64 (*.f64 -9/8 -9/8) (*.f64 (*.f64 (pow.f64 c 2) (pow.f64 c 2)) (pow.f64 a (Rewrite<= metadata-eval (*.f64 2 2))))) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (/.f64 (*.f64 (+.f64 (*.f64 (*.f64 -9/8 -9/8) (*.f64 (*.f64 (pow.f64 c 2) (pow.f64 c 2)) (Rewrite<= pow-sqr_binary64 (*.f64 (pow.f64 a 2) (pow.f64 a 2))))) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (/.f64 (*.f64 (+.f64 (*.f64 (*.f64 -9/8 -9/8) (Rewrite=> unswap-sqr_binary64 (*.f64 (*.f64 (pow.f64 c 2) (pow.f64 a 2)) (*.f64 (pow.f64 c 2) (pow.f64 a 2))))) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (/.f64 (*.f64 (+.f64 (Rewrite<= swap-sqr_binary64 (*.f64 (*.f64 -9/8 (*.f64 (pow.f64 c 2) (pow.f64 a 2))) (*.f64 -9/8 (*.f64 (pow.f64 c 2) (pow.f64 a 2))))) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (/.f64 (*.f64 (+.f64 (Rewrite<= unpow2_binary64 (pow.f64 (*.f64 -9/8 (*.f64 (pow.f64 c 2) (pow.f64 a 2))) 2)) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) -1/6) (*.f64 a (pow.f64 b 7)))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 (+.f64 (pow.f64 (*.f64 -9/8 (*.f64 (pow.f64 c 2) (pow.f64 a 2))) 2) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) (*.f64 a (pow.f64 b 7))) -1/6))))): 1 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (fma.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (Rewrite<= *-commutative_binary64 (*.f64 -1/6 (/.f64 (+.f64 (pow.f64 (*.f64 -9/8 (*.f64 (pow.f64 c 2) (pow.f64 a 2))) 2) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) (*.f64 a (pow.f64 b 7)))))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (fma.f64 -1/2 (/.f64 c b) (Rewrite<= fma-def_binary64 (+.f64 (*.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3))) (*.f64 -1/6 (/.f64 (+.f64 (pow.f64 (*.f64 -9/8 (*.f64 (pow.f64 c 2) (pow.f64 a 2))) 2) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) (*.f64 a (pow.f64 b 7)))))))): 0 points increase in error, 1 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (Rewrite<= fma-def_binary64 (+.f64 (*.f64 -1/2 (/.f64 c b)) (+.f64 (*.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3))) (*.f64 -1/6 (/.f64 (+.f64 (pow.f64 (*.f64 -9/8 (*.f64 (pow.f64 c 2) (pow.f64 a 2))) 2) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) (*.f64 a (pow.f64 b 7)))))))): 0 points increase in error, 0 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 (*.f64 -1/2 (/.f64 c b)) (*.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)))) (*.f64 -1/6 (/.f64 (+.f64 (pow.f64 (*.f64 -9/8 (*.f64 (pow.f64 c 2) (pow.f64 a 2))) 2) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) (*.f64 a (pow.f64 b 7))))))): 10 points increase in error, 8 points decrease in error
      (fma.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)) (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 -1/6 (/.f64 (+.f64 (pow.f64 (*.f64 -9/8 (*.f64 (pow.f64 c 2) (pow.f64 a 2))) 2) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) (*.f64 a (pow.f64 b 7)))) (+.f64 (*.f64 -1/2 (/.f64 c b)) (*.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3))))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= fma-def_binary64 (+.f64 (*.f64 -9/16 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5))) (+.f64 (*.f64 -1/6 (/.f64 (+.f64 (pow.f64 (*.f64 -9/8 (*.f64 (pow.f64 c 2) (pow.f64 a 2))) 2) (*.f64 81/16 (*.f64 (pow.f64 c 4) (pow.f64 a 4)))) (*.f64 a (pow.f64 b 7)))) (+.f64 (*.f64 -1/2 (/.f64 c b)) (*.f64 -3/8 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3))))))): 0 points increase in error, 0 points decrease in error
    4. Applied egg-rr4.1

      \[\leadsto \mathsf{fma}\left(-0.5625, \left(a \cdot a\right) \cdot \frac{{c}^{3}}{{b}^{5}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, a \cdot \frac{c \cdot c}{{b}^{3}}, \color{blue}{\frac{{\left(a \cdot c\right)}^{4}}{{b}^{7}} \cdot \frac{-1.0546875}{a}}\right)\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification5.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -1:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) - b \cdot b}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5625, \left(a \cdot a\right) \cdot \frac{{c}^{3}}{{b}^{5}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, a \cdot \frac{c \cdot c}{{b}^{3}}, \frac{{\left(a \cdot c\right)}^{4}}{{b}^{7}} \cdot \frac{-1.0546875}{a}\right)\right)\right)\\ \end{array} \]

Alternatives

Alternative 1
Error6.5
Cost40964
\[\begin{array}{l} t_0 := c \cdot \left(a \cdot -3\right)\\ t_1 := \mathsf{fma}\left(b, b, t_0\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + t_0} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;\frac{\frac{t_1 - b \cdot b}{b + \sqrt{t_1}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.375, a \cdot \frac{c \cdot c}{{b}^{3}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \frac{a \cdot \left(a \cdot {c}^{3}\right)}{\frac{{b}^{5}}{-0.5625}}\right)\right)\\ \end{array} \]
Alternative 2
Error6.5
Cost34564
\[\begin{array}{l} t_0 := c \cdot \left(a \cdot -3\right)\\ t_1 := \mathsf{fma}\left(b, b, t_0\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + t_0} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;\frac{\frac{t_1 - b \cdot b}{b + \sqrt{t_1}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \frac{c}{b}, a \cdot \left(-0.375 \cdot \frac{c \cdot c}{{b}^{3}} + \frac{-0.5625 \cdot {c}^{3}}{\frac{{b}^{5}}{a}}\right)\right)\\ \end{array} \]
Alternative 3
Error6.6
Cost28228
\[\begin{array}{l} t_0 := c \cdot \left(a \cdot -3\right)\\ t_1 := \mathsf{fma}\left(b, b, t_0\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + t_0} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;\frac{\frac{t_1 - b \cdot b}{b + \sqrt{t_1}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c, \frac{-0.5}{b}, \left(c \cdot \left(a \cdot c\right)\right) \cdot \left(\frac{-0.375}{{b}^{3}} + \frac{c \cdot -0.5625}{\frac{{b}^{5}}{a}}\right)\right)\\ \end{array} \]
Alternative 4
Error6.7
Cost28100
\[\begin{array}{l} t_0 := c \cdot \left(a \cdot -3\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + t_0} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, t_0\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c, \frac{-0.5}{b}, \left(c \cdot \left(a \cdot c\right)\right) \cdot \left(\frac{-0.375}{{b}^{3}} + \frac{c \cdot -0.5625}{\frac{{b}^{5}}{a}}\right)\right)\\ \end{array} \]
Alternative 5
Error9.2
Cost21124
\[\begin{array}{l} t_0 := c \cdot \left(a \cdot -3\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + t_0} - b}{3 \cdot a} \leq -0.0025:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, t_0\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.375, a \cdot \frac{c}{\frac{{b}^{3}}{c}}, -0.5 \cdot \frac{c}{b}\right)\\ \end{array} \]
Alternative 6
Error9.2
Cost21060
\[\begin{array}{l} t_0 := c \cdot \left(a \cdot -3\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + t_0} - b}{3 \cdot a} \leq -0.0025:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, t_0\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(\frac{-0.5}{b} + \frac{a \cdot -0.375}{\frac{{b}^{3}}{c}}\right)\\ \end{array} \]
Alternative 7
Error9.2
Cost14788
\[\begin{array}{l} t_0 := \frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a}\\ \mathbf{if}\;t_0 \leq -0.0025:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(\frac{-0.5}{b} + \frac{a \cdot -0.375}{\frac{{b}^{3}}{c}}\right)\\ \end{array} \]
Alternative 8
Error12.1
Cost7492
\[\begin{array}{l} \mathbf{if}\;c \leq 950:\\ \;\;\;\;c \cdot \left(\frac{-0.5}{b} + \frac{a \cdot -0.375}{\frac{{b}^{3}}{c}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\ \end{array} \]
Alternative 9
Error11.6
Cost7296
\[c \cdot \left(\frac{-0.5}{b} + \frac{a \cdot -0.375}{\frac{{b}^{3}}{c}}\right) \]
Alternative 10
Error22.5
Cost320
\[c \cdot \frac{-0.5}{b} \]
Alternative 11
Error22.5
Cost320
\[-0.5 \cdot \frac{c}{b} \]

Error

Reproduce

herbie shell --seed 2022294 
(FPCore (a b c)
  :name "Cubic critical, narrow range"
  :precision binary64
  :pre (and (and (and (< 1.0536712127723509e-8 a) (< a 94906265.62425156)) (and (< 1.0536712127723509e-8 b) (< b 94906265.62425156))) (and (< 1.0536712127723509e-8 c) (< c 94906265.62425156)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))