Average Error: 28.3 → 5.5
Time: 12.7s
Precision: binary64
Cost: 42308
\[\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(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
\[\begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -0.4:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c, a \cdot -4, 4 \cdot \left(a \cdot c\right)\right) + \mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.25, \frac{{a}^{3}}{b} \cdot \left(\left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot {b}^{-6}\right)\right) \cdot 20\right), -2 \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \frac{a}{\frac{{b}^{5}}{a}}\right)\right)\right) - \left(\frac{c}{b} + a \cdot \frac{c}{\frac{{b}^{3}}{c}}\right)\\ \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* (* 4.0 a) c))) b) (* a 2.0)) -0.4)
   (/
    (-
     (sqrt (+ (fma c (* a -4.0) (* 4.0 (* a c))) (fma b b (* -4.0 (* a c)))))
     b)
    (* a 2.0))
   (-
    (fma
     -0.25
     (* (/ (pow a 3.0) b) (* (* (* c c) (* (* c c) (pow b -6.0))) 20.0))
     (* -2.0 (* (* c c) (* c (/ a (/ (pow b 5.0) a))))))
    (+ (/ c b) (* a (/ c (/ (pow b 3.0) c)))))))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - ((4.0 * a) * c))) - b) / (a * 2.0)) <= -0.4) {
		tmp = (sqrt((fma(c, (a * -4.0), (4.0 * (a * c))) + fma(b, b, (-4.0 * (a * c))))) - b) / (a * 2.0);
	} else {
		tmp = fma(-0.25, ((pow(a, 3.0) / b) * (((c * c) * ((c * c) * pow(b, -6.0))) * 20.0)), (-2.0 * ((c * c) * (c * (a / (pow(b, 5.0) / a)))))) - ((c / b) + (a * (c / (pow(b, 3.0) / c))));
	}
	return tmp;
}
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
end
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) - b) / Float64(a * 2.0)) <= -0.4)
		tmp = Float64(Float64(sqrt(Float64(fma(c, Float64(a * -4.0), Float64(4.0 * Float64(a * c))) + fma(b, b, Float64(-4.0 * Float64(a * c))))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(fma(-0.25, Float64(Float64((a ^ 3.0) / b) * Float64(Float64(Float64(c * c) * Float64(Float64(c * c) * (b ^ -6.0))) * 20.0)), Float64(-2.0 * Float64(Float64(c * c) * Float64(c * Float64(a / Float64((b ^ 5.0) / a)))))) - Float64(Float64(c / b) + Float64(a * Float64(c / Float64((b ^ 3.0) / c)))));
	end
	return tmp
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
code[a_, b_, c_] := If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -0.4], N[(N[(N[Sqrt[N[(N[(c * N[(a * -4.0), $MachinePrecision] + N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * b + N[(-4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(-0.25 * N[(N[(N[Power[a, 3.0], $MachinePrecision] / b), $MachinePrecision] * N[(N[(N[(c * c), $MachinePrecision] * N[(N[(c * c), $MachinePrecision] * N[Power[b, -6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 20.0), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(N[(c * c), $MachinePrecision] * N[(c * N[(a / N[(N[Power[b, 5.0], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(c / b), $MachinePrecision] + N[(a * N[(c / N[(N[Power[b, 3.0], $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -0.4:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c, a \cdot -4, 4 \cdot \left(a \cdot c\right)\right) + \mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)} - b}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, \frac{{a}^{3}}{b} \cdot \left(\left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot {b}^{-6}\right)\right) \cdot 20\right), -2 \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \frac{a}{\frac{{b}^{5}}{a}}\right)\right)\right) - \left(\frac{c}{b} + a \cdot \frac{c}{\frac{{b}^{3}}{c}}\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 4 a) c)))) (*.f64 2 a)) < -0.40000000000000002

    1. Initial program 12.0

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

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

    if -0.40000000000000002 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))

    1. Initial program 32.0

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right) \cdot \frac{0.5}{a}} \]
      Proof
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (*.f64 c -4) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (*.f64 c (Rewrite<= metadata-eval (neg.f64 4))) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 c 4))) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (neg.f64 (Rewrite=> *-commutative_binary64 (*.f64 4 c))) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (Rewrite=> distribute-lft-neg-in_binary64 (*.f64 (neg.f64 4) c)) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 a (*.f64 (neg.f64 4) c)) (*.f64 b b)))) b) (/.f64 1/2 a)): 3 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (+.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 a (neg.f64 4)) c)) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (+.f64 (*.f64 (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 a 4))) c) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (+.f64 (*.f64 (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 4 a))) c) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 b b) (*.f64 (neg.f64 (*.f64 4 a)) c)))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (Rewrite<= cancel-sign-sub-inv_binary64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) (neg.f64 b))) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= +-commutative_binary64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (/.f64 (Rewrite<= metadata-eval (/.f64 1 2)) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (/.f64 (/.f64 (Rewrite<= metadata-eval (neg.f64 -1)) 2) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (Rewrite<= associate-/r*_binary64 (/.f64 (neg.f64 -1) (*.f64 2 a)))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (neg.f64 -1)) (*.f64 2 a))): 23 points increase in error, 32 points decrease in error
      (Rewrite=> associate-/l*_binary64 (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (/.f64 (*.f64 2 a) (neg.f64 -1)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (/.f64 (*.f64 2 a) (Rewrite=> metadata-eval 1))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (Rewrite=> /-rgt-identity_binary64 (*.f64 2 a))): 0 points increase in error, 0 points decrease in error
    3. Applied egg-rr32.7

      \[\leadsto \left(\color{blue}{\sqrt[3]{{\left(\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -4\right)\right)}^{1.5}}} - b\right) \cdot \frac{0.5}{a} \]
    4. Taylor expanded in a around 0 4.1

      \[\leadsto \color{blue}{-1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + \left(-1 \cdot \frac{c}{b} + \left(-0.25 \cdot \frac{{a}^{3} \cdot \left(16 \cdot \frac{{c}^{4}}{{b}^{6}} + {\left(-2 \cdot \frac{{c}^{2}}{{b}^{3}}\right)}^{2}\right)}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right)} \]
    5. Simplified4.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25, \frac{{a}^{3}}{b} \cdot \left(\frac{{c}^{4}}{{b}^{6}} \cdot 20\right), -2 \cdot \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}\right) - \left(\frac{c}{b} + \frac{c}{\frac{{b}^{3}}{c}} \cdot a\right)} \]
      Proof
      (-.f64 (fma.f64 -1/4 (*.f64 (/.f64 (pow.f64 a 3) b) (*.f64 (/.f64 (pow.f64 c 4) (pow.f64 b 6)) 20)) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (*.f64 a a))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (fma.f64 -1/4 (*.f64 (/.f64 (pow.f64 a 3) b) (*.f64 (/.f64 (pow.f64 c 4) (pow.f64 b 6)) (Rewrite<= metadata-eval (+.f64 16 4)))) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (*.f64 a a))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (fma.f64 -1/4 (*.f64 (/.f64 (pow.f64 a 3) b) (Rewrite<= distribute-rgt-out_binary64 (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (*.f64 4 (/.f64 (pow.f64 c 4) (pow.f64 b 6)))))) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (*.f64 a a))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (fma.f64 -1/4 (*.f64 (/.f64 (pow.f64 a 3) b) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (*.f64 (Rewrite<= metadata-eval (*.f64 -2 -2)) (/.f64 (pow.f64 c 4) (pow.f64 b 6))))) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (*.f64 a a))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (fma.f64 -1/4 (*.f64 (/.f64 (pow.f64 a 3) b) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (*.f64 (*.f64 -2 -2) (/.f64 (pow.f64 c (Rewrite<= metadata-eval (*.f64 2 2))) (pow.f64 b 6))))) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (*.f64 a a))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (fma.f64 -1/4 (*.f64 (/.f64 (pow.f64 a 3) b) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (*.f64 (*.f64 -2 -2) (/.f64 (Rewrite<= pow-sqr_binary64 (*.f64 (pow.f64 c 2) (pow.f64 c 2))) (pow.f64 b 6))))) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (*.f64 a a))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (fma.f64 -1/4 (*.f64 (/.f64 (pow.f64 a 3) b) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (*.f64 (*.f64 -2 -2) (/.f64 (*.f64 (pow.f64 c 2) (pow.f64 c 2)) (pow.f64 b (Rewrite<= metadata-eval (*.f64 2 3))))))) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (*.f64 a a))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (fma.f64 -1/4 (*.f64 (/.f64 (pow.f64 a 3) b) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (*.f64 (*.f64 -2 -2) (/.f64 (*.f64 (pow.f64 c 2) (pow.f64 c 2)) (Rewrite<= pow-sqr_binary64 (*.f64 (pow.f64 b 3) (pow.f64 b 3))))))) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (*.f64 a a))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (fma.f64 -1/4 (*.f64 (/.f64 (pow.f64 a 3) b) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (*.f64 (*.f64 -2 -2) (Rewrite=> times-frac_binary64 (*.f64 (/.f64 (pow.f64 c 2) (pow.f64 b 3)) (/.f64 (pow.f64 c 2) (pow.f64 b 3))))))) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (*.f64 a a))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (fma.f64 -1/4 (*.f64 (/.f64 (pow.f64 a 3) b) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (Rewrite<= swap-sqr_binary64 (*.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))))))) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (*.f64 a a))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (fma.f64 -1/4 (*.f64 (/.f64 (pow.f64 a 3) b) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (Rewrite<= unpow2_binary64 (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2)))) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (*.f64 a a))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (fma.f64 -1/4 (Rewrite<= associate-/r/_binary64 (/.f64 (pow.f64 a 3) (/.f64 b (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))))) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (*.f64 a a))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 1 points increase in error, 0 points decrease in error
      (-.f64 (fma.f64 -1/4 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b)) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (*.f64 a a))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 1 points decrease in error
      (-.f64 (fma.f64 -1/4 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b) (*.f64 -2 (/.f64 (pow.f64 c 3) (/.f64 (pow.f64 b 5) (Rewrite<= unpow2_binary64 (pow.f64 a 2)))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (fma.f64 -1/4 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b) (*.f64 -2 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 1 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 -1/4 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b)) (*.f64 -2 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5))))) (+.f64 (/.f64 c b) (*.f64 (/.f64 c (/.f64 (pow.f64 b 3) c)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (*.f64 -1/4 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b)) (*.f64 -2 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)))) (+.f64 (/.f64 c b) (*.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 c c) (pow.f64 b 3))) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (*.f64 -1/4 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b)) (*.f64 -2 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)))) (+.f64 (/.f64 c b) (*.f64 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 c 2)) (pow.f64 b 3)) a))): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (*.f64 -1/4 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b)) (*.f64 -2 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)))) (+.f64 (/.f64 c b) (Rewrite<= associate-/r/_binary64 (/.f64 (pow.f64 c 2) (/.f64 (pow.f64 b 3) a))))): 0 points increase in error, 1 points decrease in error
      (-.f64 (+.f64 (*.f64 -1/4 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b)) (*.f64 -2 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)))) (+.f64 (/.f64 c b) (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3))))): 1 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (*.f64 -1/4 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b)) (*.f64 -2 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)))) (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (/.f64 c b)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= unsub-neg_binary64 (+.f64 (+.f64 (*.f64 -1/4 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b)) (*.f64 -2 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)))) (neg.f64 (+.f64 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (/.f64 c b))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (*.f64 -1/4 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b)) (*.f64 -2 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)))) (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (+.f64 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3)) (/.f64 c b))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (*.f64 -1/4 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b)) (*.f64 -2 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)))) (Rewrite<= distribute-lft-out_binary64 (+.f64 (*.f64 -1 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3))) (*.f64 -1 (/.f64 c b))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (+.f64 (*.f64 -1 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3))) (*.f64 -1 (/.f64 c b))) (+.f64 (*.f64 -1/4 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b)) (*.f64 -2 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5)))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-+r+_binary64 (+.f64 (*.f64 -1 (/.f64 (*.f64 (pow.f64 c 2) a) (pow.f64 b 3))) (+.f64 (*.f64 -1 (/.f64 c b)) (+.f64 (*.f64 -1/4 (/.f64 (*.f64 (pow.f64 a 3) (+.f64 (*.f64 16 (/.f64 (pow.f64 c 4) (pow.f64 b 6))) (pow.f64 (*.f64 -2 (/.f64 (pow.f64 c 2) (pow.f64 b 3))) 2))) b)) (*.f64 -2 (/.f64 (*.f64 (pow.f64 c 3) (pow.f64 a 2)) (pow.f64 b 5))))))): 0 points increase in error, 3 points decrease in error
    6. Applied egg-rr4.1

      \[\leadsto \mathsf{fma}\left(-0.25, \frac{{a}^{3}}{b} \cdot \left(\frac{{c}^{4}}{{b}^{6}} \cdot 20\right), -2 \cdot \color{blue}{\left(\left(c \cdot c\right) \cdot \left(c \cdot \frac{a}{\frac{{b}^{5}}{a}}\right)\right)}\right) - \left(\frac{c}{b} + \frac{c}{\frac{{b}^{3}}{c}} \cdot a\right) \]
    7. Applied egg-rr4.1

      \[\leadsto \mathsf{fma}\left(-0.25, \frac{{a}^{3}}{b} \cdot \left(\color{blue}{\left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot {b}^{-6}\right)\right)} \cdot 20\right), -2 \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \frac{a}{\frac{{b}^{5}}{a}}\right)\right)\right) - \left(\frac{c}{b} + \frac{c}{\frac{{b}^{3}}{c}} \cdot a\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification5.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -0.4:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c, a \cdot -4, 4 \cdot \left(a \cdot c\right)\right) + \mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.25, \frac{{a}^{3}}{b} \cdot \left(\left(\left(c \cdot c\right) \cdot \left(\left(c \cdot c\right) \cdot {b}^{-6}\right)\right) \cdot 20\right), -2 \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \frac{a}{\frac{{b}^{5}}{a}}\right)\right)\right) - \left(\frac{c}{b} + a \cdot \frac{c}{\frac{{b}^{3}}{c}}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error6.8
Cost28100
\[\begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -0.2063:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c, a \cdot -4, 4 \cdot \left(a \cdot c\right)\right) + \mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\frac{-2 \cdot {c}^{3}}{\frac{{b}^{5}}{a}} - \frac{c}{\frac{{b}^{3}}{c}}\right) - \frac{c}{b}\\ \end{array} \]
Alternative 2
Error6.8
Cost28036
\[\begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -0.2063:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\frac{-2 \cdot {c}^{3}}{\frac{{b}^{5}}{a}} - \frac{c}{\frac{{b}^{3}}{c}}\right) - \frac{c}{b}\\ \end{array} \]
Alternative 3
Error9.5
Cost21124
\[\begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -0.1:\\ \;\;\;\;\left({\left(\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)\right)}^{0.5} - b\right) \cdot \frac{0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{c}{b}\right) - a \cdot \frac{c}{\frac{{b}^{3}}{c}}\\ \end{array} \]
Alternative 4
Error9.5
Cost21060
\[\begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -0.1:\\ \;\;\;\;\frac{0.5}{a} \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{c}{b}\right) - a \cdot \frac{c}{\frac{{b}^{3}}{c}}\\ \end{array} \]
Alternative 5
Error9.5
Cost21060
\[\begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -0.1:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{c}{b}\right) - a \cdot \frac{c}{\frac{{b}^{3}}{c}}\\ \end{array} \]
Alternative 6
Error9.5
Cost14788
\[\begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -0.1:\\ \;\;\;\;\frac{0.5}{a} \cdot \left(\sqrt{b \cdot b + -4 \cdot \left(a \cdot c\right)} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{c}{b}\right) - a \cdot \frac{c}{\frac{{b}^{3}}{c}}\\ \end{array} \]
Alternative 7
Error12.1
Cost7232
\[\left(-\frac{c}{b}\right) - a \cdot \frac{c}{\frac{{b}^{3}}{c}} \]
Alternative 8
Error12.2
Cost832
\[\frac{c}{b} \cdot \left(-1 - \frac{a \cdot c}{b \cdot b}\right) \]
Alternative 9
Error23.0
Cost256
\[-\frac{c}{b} \]
Alternative 10
Error63.0
Cost192
\[\frac{c}{b} \]

Error

Reproduce

herbie shell --seed 2022297 
(FPCore (a b c)
  :name "Quadratic roots, 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) (* (* 4.0 a) c)))) (* 2.0 a)))