Average Error: 28.9 → 5.3
Time: 29.0s
Precision: binary64
Cost: 67268
\[\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 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;\frac{\sqrt{3 \cdot \left(a \cdot c\right)}}{\frac{a \cdot -3}{\frac{\sqrt{b \cdot b - t_0}}{b + \sqrt{t_0}}}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, {a}^{3} \cdot \frac{{c}^{4} \cdot -3.1640625}{{b}^{7}}, \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{{b}^{5}} \cdot \left(a \cdot a\right), \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right)\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 (fma a (* c -3.0) (* b b))))
   (if (<= (/ (- (sqrt (+ (* b b) (* c (* a -3.0)))) b) (* 3.0 a)) -0.04)
     (/
      (sqrt (* 3.0 (* a c)))
      (/ (* a -3.0) (/ (sqrt (- (* b b) t_0)) (+ b (sqrt t_0)))))
     (fma
      0.3333333333333333
      (* (pow a 3.0) (/ (* (pow c 4.0) -3.1640625) (pow b 7.0)))
      (fma
       -0.5625
       (* (/ (pow c 3.0) (pow b 5.0)) (* a a))
       (fma -0.5 (/ c b) (* -0.375 (* a (/ (* c c) (pow b 3.0))))))))))
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 = fma(a, (c * -3.0), (b * b));
	double tmp;
	if (((sqrt(((b * b) + (c * (a * -3.0)))) - b) / (3.0 * a)) <= -0.04) {
		tmp = sqrt((3.0 * (a * c))) / ((a * -3.0) / (sqrt(((b * b) - t_0)) / (b + sqrt(t_0))));
	} else {
		tmp = fma(0.3333333333333333, (pow(a, 3.0) * ((pow(c, 4.0) * -3.1640625) / pow(b, 7.0))), fma(-0.5625, ((pow(c, 3.0) / pow(b, 5.0)) * (a * a)), fma(-0.5, (c / b), (-0.375 * (a * ((c * c) / pow(b, 3.0)))))));
	}
	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 = fma(a, Float64(c * -3.0), Float64(b * b))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -3.0)))) - b) / Float64(3.0 * a)) <= -0.04)
		tmp = Float64(sqrt(Float64(3.0 * Float64(a * c))) / Float64(Float64(a * -3.0) / Float64(sqrt(Float64(Float64(b * b) - t_0)) / Float64(b + sqrt(t_0)))));
	else
		tmp = fma(0.3333333333333333, Float64((a ^ 3.0) * Float64(Float64((c ^ 4.0) * -3.1640625) / (b ^ 7.0))), fma(-0.5625, Float64(Float64((c ^ 3.0) / (b ^ 5.0)) * Float64(a * a)), fma(-0.5, Float64(c / b), Float64(-0.375 * Float64(a * Float64(Float64(c * c) / (b ^ 3.0)))))));
	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[(a * N[(c * -3.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], -0.04], N[(N[Sqrt[N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(a * -3.0), $MachinePrecision] / N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 * N[(N[Power[a, 3.0], $MachinePrecision] * N[(N[(N[Power[c, 4.0], $MachinePrecision] * -3.1640625), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5625 * N[(N[(N[Power[c, 3.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] * N[(a * a), $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]), $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 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.04:\\
\;\;\;\;\frac{\sqrt{3 \cdot \left(a \cdot c\right)}}{\frac{a \cdot -3}{\frac{\sqrt{b \cdot b - t_0}}{b + \sqrt{t_0}}}}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333, {a}^{3} \cdot \frac{{c}^{4} \cdot -3.1640625}{{b}^{7}}, \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{{b}^{5}} \cdot \left(a \cdot a\right), \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right)\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)) < -0.0400000000000000008

    1. Initial program 13.0

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

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

      [Start]13.0

      \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]

      remove-double-neg [<=]13.0

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

      sub-neg [<=]13.0

      \[ \frac{\color{blue}{\left(-b\right) - \left(-\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]

      div-sub [=>]13.6

      \[ \color{blue}{\frac{-b}{3 \cdot a} - \frac{-\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}} \]

      neg-mul-1 [=>]13.6

      \[ \frac{\color{blue}{-1 \cdot b}}{3 \cdot a} - \frac{-\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]

      associate-*l/ [<=]13.7

      \[ \color{blue}{\frac{-1}{3 \cdot a} \cdot b} - \frac{-\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]

      distribute-frac-neg [=>]13.7

      \[ \frac{-1}{3 \cdot a} \cdot b - \color{blue}{\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)} \]

      fma-neg [=>]13.5

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

      /-rgt-identity [<=]13.5

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

      metadata-eval [<=]13.5

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

      associate-/l* [<=]13.5

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

      *-commutative [<=]13.5

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

      neg-mul-1 [<=]13.5

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

      fma-neg [<=]13.7

      \[ \color{blue}{\frac{-1}{3 \cdot a} \cdot \frac{-b}{-1} - \left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)} \]

      neg-mul-1 [=>]13.7

      \[ \frac{-1}{3 \cdot a} \cdot \frac{-b}{-1} - \color{blue}{-1 \cdot \frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}} \]
    3. Applied egg-rr13.1

      \[\leadsto \color{blue}{e^{\log \left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)}} \cdot \frac{-0.3333333333333333}{a} \]
    4. Applied egg-rr12.1

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

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

      [Start]12.1

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

      associate-/l* [=>]12.1

      \[ \frac{\sqrt{b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{\color{blue}{\frac{a \cdot -3}{\frac{\sqrt{b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}}}} \]
    6. Taylor expanded in b around 0 11.3

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

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

    1. Initial program 33.3

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

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

      [Start]33.3

      \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]

      remove-double-neg [<=]33.3

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

      sub-neg [<=]33.3

      \[ \frac{\color{blue}{\left(-b\right) - \left(-\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]

      div-sub [=>]33.8

      \[ \color{blue}{\frac{-b}{3 \cdot a} - \frac{-\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}} \]

      neg-mul-1 [=>]33.8

      \[ \frac{\color{blue}{-1 \cdot b}}{3 \cdot a} - \frac{-\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]

      associate-*l/ [<=]33.8

      \[ \color{blue}{\frac{-1}{3 \cdot a} \cdot b} - \frac{-\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]

      distribute-frac-neg [=>]33.8

      \[ \frac{-1}{3 \cdot a} \cdot b - \color{blue}{\left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)} \]

      fma-neg [=>]33.2

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

      /-rgt-identity [<=]33.2

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

      metadata-eval [<=]33.2

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

      associate-/l* [<=]33.2

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

      *-commutative [<=]33.2

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

      neg-mul-1 [<=]33.2

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

      fma-neg [<=]33.8

      \[ \color{blue}{\frac{-1}{3 \cdot a} \cdot \frac{-b}{-1} - \left(-\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\right)} \]

      neg-mul-1 [=>]33.8

      \[ \frac{-1}{3 \cdot a} \cdot \frac{-b}{-1} - \color{blue}{-1 \cdot \frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}} \]
    3. Applied egg-rr33.3

      \[\leadsto \color{blue}{e^{\log \left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}\right)}} \cdot \frac{-0.3333333333333333}{a} \]
    4. Applied egg-rr32.4

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

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

      [Start]32.4

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

      associate-/l* [=>]32.4

      \[ \frac{\sqrt{b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{\color{blue}{\frac{a \cdot -3}{\frac{\sqrt{b \cdot b - \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}}}} \]
    6. Taylor expanded in a around 0 3.6

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \left({a}^{3} \cdot \left(-2.53125 \cdot \frac{{c}^{4}}{{b}^{7}} + -0.6328125 \cdot \frac{{c}^{4}}{{b}^{7}}\right)\right) + \left(-0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right)} \]
    7. Simplified3.6

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.3333333333333333, {a}^{3} \cdot \frac{{c}^{4} \cdot -3.1640625}{{b}^{7}}, \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{{b}^{5}} \cdot \left(a \cdot a\right), \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \left(\frac{c \cdot c}{{b}^{3}} \cdot a\right)\right)\right)\right)} \]
      Proof

      [Start]3.6

      \[ 0.3333333333333333 \cdot \left({a}^{3} \cdot \left(-2.53125 \cdot \frac{{c}^{4}}{{b}^{7}} + -0.6328125 \cdot \frac{{c}^{4}}{{b}^{7}}\right)\right) + \left(-0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right) \]

      fma-def [=>]3.6

      \[ \color{blue}{\mathsf{fma}\left(0.3333333333333333, {a}^{3} \cdot \left(-2.53125 \cdot \frac{{c}^{4}}{{b}^{7}} + -0.6328125 \cdot \frac{{c}^{4}}{{b}^{7}}\right), -0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right)} \]

      distribute-rgt-out [=>]3.6

      \[ \mathsf{fma}\left(0.3333333333333333, {a}^{3} \cdot \color{blue}{\left(\frac{{c}^{4}}{{b}^{7}} \cdot \left(-2.53125 + -0.6328125\right)\right)}, -0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right) \]

      metadata-eval [=>]3.6

      \[ \mathsf{fma}\left(0.3333333333333333, {a}^{3} \cdot \left(\frac{{c}^{4}}{{b}^{7}} \cdot \color{blue}{-3.1640625}\right), -0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right) \]

      metadata-eval [<=]3.6

      \[ \mathsf{fma}\left(0.3333333333333333, {a}^{3} \cdot \left(\frac{{c}^{4}}{{b}^{7}} \cdot \color{blue}{\left(-0.6328125 + -2.53125\right)}\right), -0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right) \]

      associate-*l/ [=>]3.6

      \[ \mathsf{fma}\left(0.3333333333333333, {a}^{3} \cdot \color{blue}{\frac{{c}^{4} \cdot \left(-0.6328125 + -2.53125\right)}{{b}^{7}}}, -0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right) \]

      metadata-eval [=>]3.6

      \[ \mathsf{fma}\left(0.3333333333333333, {a}^{3} \cdot \frac{{c}^{4} \cdot \color{blue}{-3.1640625}}{{b}^{7}}, -0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right) \]

      fma-def [=>]3.6

      \[ \mathsf{fma}\left(0.3333333333333333, {a}^{3} \cdot \frac{{c}^{4} \cdot -3.1640625}{{b}^{7}}, \color{blue}{\mathsf{fma}\left(-0.5625, \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}, -0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)}\right) \]

      associate-/l* [=>]3.6

      \[ \mathsf{fma}\left(0.3333333333333333, {a}^{3} \cdot \frac{{c}^{4} \cdot -3.1640625}{{b}^{7}}, \mathsf{fma}\left(-0.5625, \color{blue}{\frac{{c}^{3}}{\frac{{b}^{5}}{{a}^{2}}}}, -0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right) \]

      associate-/r/ [=>]3.6

      \[ \mathsf{fma}\left(0.3333333333333333, {a}^{3} \cdot \frac{{c}^{4} \cdot -3.1640625}{{b}^{7}}, \mathsf{fma}\left(-0.5625, \color{blue}{\frac{{c}^{3}}{{b}^{5}} \cdot {a}^{2}}, -0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right) \]

      unpow2 [=>]3.6

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

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

Alternatives

Alternative 1
Error5.3
Cost55684
\[\begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;\frac{\sqrt{3 \cdot \left(a \cdot c\right)}}{\frac{a \cdot -3}{\frac{\sqrt{b \cdot b - t_0}}{b + \sqrt{t_0}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.3333333333333333}{a \cdot \left(\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.5625, \left(a \cdot a\right) \cdot \left(c \cdot c\right), c \cdot \left(c \cdot \mathsf{fma}\left(a, a \cdot -0.28125, \frac{0.2222222222222222}{a} \cdot \frac{{a}^{4}}{a \cdot 0.1580246913580247}\right)\right)\right)}{{b}^{5}}, \mathsf{fma}\left(-1, \frac{a \cdot 0.375}{\frac{{b}^{3}}{c}}, \frac{0.6666666666666666}{c} \cdot \frac{b}{a}\right)\right) + \frac{-0.5}{b}\right)}\\ \end{array} \]
Alternative 2
Error5.3
Cost42308
\[\begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;\frac{\sqrt{3 \cdot \left(a \cdot c\right)}}{\frac{a \cdot -3}{\frac{\sqrt{b \cdot b - t_0}}{b + \sqrt{t_0}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.3333333333333333}{a}}{\mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-0.5625, \left(a \cdot a\right) \cdot \left(c \cdot c\right), \left(c \cdot c\right) \cdot \left(\left(a \cdot a\right) \cdot 1.125\right)\right)}{{b}^{5}}, \mathsf{fma}\left(-1, \frac{\left(a \cdot c\right) \cdot 0.375}{{b}^{3}}, \frac{b \cdot 0.6666666666666666}{a \cdot c}\right)\right) + \frac{-0.5}{b}}\\ \end{array} \]
Alternative 3
Error6.4
Cost41412
\[\begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;\frac{\sqrt{3 \cdot \left(a \cdot c\right)}}{\frac{a \cdot -3}{\frac{\sqrt{b \cdot b - t_0}}{b + \sqrt{t_0}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.3333333333333333}{a}}{\mathsf{fma}\left(-c, \frac{a \cdot 0.375}{{b}^{3}}, \mathsf{fma}\left(0.6666666666666666, \frac{b}{a \cdot c}, \frac{-0.5}{b}\right)\right)}\\ \end{array} \]
Alternative 4
Error6.5
Cost28356
\[\begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;\frac{-0.3333333333333333}{a} \cdot \left(\left(b \cdot b - t_0\right) \cdot \frac{1}{b + \sqrt{t_0}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.3333333333333333}{a}}{\mathsf{fma}\left(-c, \frac{a \cdot 0.375}{{b}^{3}}, \mathsf{fma}\left(0.6666666666666666, \frac{b}{a \cdot c}, \frac{-0.5}{b}\right)\right)}\\ \end{array} \]
Alternative 5
Error6.5
Cost28228
\[\begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{\frac{b \cdot b - t_0}{a}}{b + \sqrt{t_0}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.3333333333333333}{a}}{\mathsf{fma}\left(-c, \frac{a \cdot 0.375}{{b}^{3}}, \mathsf{fma}\left(0.6666666666666666, \frac{b}{a \cdot c}, \frac{-0.5}{b}\right)\right)}\\ \end{array} \]
Alternative 6
Error6.5
Cost28228
\[\begin{array}{l} t_0 := \mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;\frac{-0.3333333333333333}{a} \cdot \frac{b \cdot b - t_0}{b + \sqrt{t_0}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.3333333333333333}{a}}{\mathsf{fma}\left(-c, \frac{a \cdot 0.375}{{b}^{3}}, \mathsf{fma}\left(0.6666666666666666, \frac{b}{a \cdot c}, \frac{-0.5}{b}\right)\right)}\\ \end{array} \]
Alternative 7
Error6.8
Cost27972
\[\begin{array}{l} t_0 := a \cdot \left(c \cdot -3\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{\frac{t_0 \cdot t_0 - {b}^{4}}{t_0 - b \cdot b}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.3333333333333333}{a}}{\mathsf{fma}\left(-c, \frac{a \cdot 0.375}{{b}^{3}}, \mathsf{fma}\left(0.6666666666666666, \frac{b}{a \cdot c}, \frac{-0.5}{b}\right)\right)}\\ \end{array} \]
Alternative 8
Error6.8
Cost22148
\[\begin{array}{l} t_0 := a \cdot \left(c \cdot -3\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{\frac{t_0 \cdot t_0 - {b}^{4}}{t_0 - b \cdot b}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.3333333333333333}{a}}{\mathsf{fma}\left(-1, \frac{\left(a \cdot c\right) \cdot 0.375}{{b}^{3}}, \frac{b \cdot 0.6666666666666666}{a \cdot c}\right) + \frac{-0.5}{b}}\\ \end{array} \]
Alternative 9
Error6.8
Cost21764
\[\begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;\frac{1}{\frac{\frac{a}{-0.3333333333333333}}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.3333333333333333}{a}}{\mathsf{fma}\left(-1, \frac{\left(a \cdot c\right) \cdot 0.375}{{b}^{3}}, \frac{b \cdot 0.6666666666666666}{a \cdot c}\right) + \frac{-0.5}{b}}\\ \end{array} \]
Alternative 10
Error6.8
Cost21188
\[\begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;\frac{1}{\frac{\frac{a}{-0.3333333333333333}}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.3333333333333333}{a}}{\left(\frac{\left(a \cdot c\right) \cdot 0.375 + \left(a \cdot c\right) \cdot -0.75}{{b}^{3}} + 0.6666666666666666 \cdot \frac{b}{a \cdot c}\right) + -0.5 \cdot \frac{1}{b}}\\ \end{array} \]
Alternative 11
Error6.8
Cost15876
\[\begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.04:\\ \;\;\;\;\frac{-0.3333333333333333}{a} \cdot \left(b - \sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.3333333333333333}{a}}{\left(\frac{\left(a \cdot c\right) \cdot 0.375 + \left(a \cdot c\right) \cdot -0.75}{{b}^{3}} + 0.6666666666666666 \cdot \frac{b}{a \cdot c}\right) + -0.5 \cdot \frac{1}{b}}\\ \end{array} \]
Alternative 12
Error9.3
Cost14788
\[\begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a} \leq -0.012:\\ \;\;\;\;\frac{-0.3333333333333333}{a} \cdot \left(b - \sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-0.3333333333333333}{a}}{\mathsf{fma}\left(0.6666666666666666, \frac{b}{a \cdot c}, \frac{-0.5}{b}\right)}\\ \end{array} \]
Alternative 13
Error11.4
Cost7232
\[\frac{\frac{-0.3333333333333333}{a}}{\mathsf{fma}\left(0.6666666666666666, \frac{b}{a \cdot c}, \frac{-0.5}{b}\right)} \]
Alternative 14
Error11.4
Cost960
\[\frac{\frac{-0.3333333333333333}{a}}{\frac{b \cdot 0.6666666666666666}{a \cdot c} + \frac{-0.5}{b}} \]
Alternative 15
Error56.3
Cost320
\[\frac{b}{a} \cdot -0.1111111111111111 \]
Alternative 16
Error22.5
Cost320
\[\frac{-0.5}{\frac{b}{c}} \]
Alternative 17
Error22.5
Cost320
\[\frac{c \cdot -0.5}{b} \]

Error

Reproduce

herbie shell --seed 2023016 
(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)))