Quadratic roots, narrow range

Percentage Accurate: 56.0% → 92.3%
Time: 42.0s
Alternatives: 11
Speedup: 29.0×

Specification

?
\[\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)\]
\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-b + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
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 tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
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]
\begin{array}{l}

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 56.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-b + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
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 tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
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]
\begin{array}{l}

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}

Alternative 1: 92.3% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a \cdot -4, c, b \cdot b\right)\\ t_1 := \left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5\\ \mathbf{if}\;b \leq 0.155:\\ \;\;\;\;\left(t_0 - b \cdot b\right) \cdot \frac{1}{\left(a \cdot 2\right) \cdot \left(b + \sqrt{t_0}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\mathsf{fma}\left(-4, \frac{\mathsf{fma}\left(-1, a \cdot \left(c \cdot t_1\right), \mathsf{fma}\left(-0.125, \frac{\mathsf{fma}\left(16, {a}^{4} \cdot {c}^{4}, {\left(-2 \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)\right)}^{2}\right)}{a \cdot \left(c \cdot c\right)}, \left(c \cdot c\right) \cdot {a}^{3}\right)\right)}{{b}^{5}}, \mathsf{fma}\left(-4, \frac{t_1}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \frac{a \cdot 2}{b}\right)\right)\right)}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma (* a -4.0) c (* b b))) (t_1 (* (* c (* a a)) -0.5)))
   (if (<= b 0.155)
     (* (- t_0 (* b b)) (/ 1.0 (* (* a 2.0) (+ b (sqrt t_0)))))
     (/
      2.0
      (fma
       -4.0
       (/
        (fma
         -1.0
         (* a (* c t_1))
         (fma
          -0.125
          (/
           (fma
            16.0
            (* (pow a 4.0) (pow c 4.0))
            (pow (* -2.0 (* (* a a) (* c c))) 2.0))
           (* a (* c c)))
          (* (* c c) (pow a 3.0))))
        (pow b 5.0))
       (fma -4.0 (/ t_1 (pow b 3.0)) (fma -2.0 (/ b c) (/ (* a 2.0) b))))))))
double code(double a, double b, double c) {
	double t_0 = fma((a * -4.0), c, (b * b));
	double t_1 = (c * (a * a)) * -0.5;
	double tmp;
	if (b <= 0.155) {
		tmp = (t_0 - (b * b)) * (1.0 / ((a * 2.0) * (b + sqrt(t_0))));
	} else {
		tmp = 2.0 / fma(-4.0, (fma(-1.0, (a * (c * t_1)), fma(-0.125, (fma(16.0, (pow(a, 4.0) * pow(c, 4.0)), pow((-2.0 * ((a * a) * (c * c))), 2.0)) / (a * (c * c))), ((c * c) * pow(a, 3.0)))) / pow(b, 5.0)), fma(-4.0, (t_1 / pow(b, 3.0)), fma(-2.0, (b / c), ((a * 2.0) / b))));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(Float64(a * -4.0), c, Float64(b * b))
	t_1 = Float64(Float64(c * Float64(a * a)) * -0.5)
	tmp = 0.0
	if (b <= 0.155)
		tmp = Float64(Float64(t_0 - Float64(b * b)) * Float64(1.0 / Float64(Float64(a * 2.0) * Float64(b + sqrt(t_0)))));
	else
		tmp = Float64(2.0 / fma(-4.0, Float64(fma(-1.0, Float64(a * Float64(c * t_1)), fma(-0.125, Float64(fma(16.0, Float64((a ^ 4.0) * (c ^ 4.0)), (Float64(-2.0 * Float64(Float64(a * a) * Float64(c * c))) ^ 2.0)) / Float64(a * Float64(c * c))), Float64(Float64(c * c) * (a ^ 3.0)))) / (b ^ 5.0)), fma(-4.0, Float64(t_1 / (b ^ 3.0)), fma(-2.0, Float64(b / c), Float64(Float64(a * 2.0) / b)))));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(a * -4.0), $MachinePrecision] * c + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c * N[(a * a), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[b, 0.155], N[(N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(N[(a * 2.0), $MachinePrecision] * N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(-4.0 * N[(N[(-1.0 * N[(a * N[(c * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(-0.125 * N[(N[(16.0 * N[(N[Power[a, 4.0], $MachinePrecision] * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[(-2.0 * N[(N[(a * a), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(a * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(c * c), $MachinePrecision] * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] + N[(-4.0 * N[(t$95$1 / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(b / c), $MachinePrecision] + N[(N[(a * 2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a \cdot -4, c, b \cdot b\right)\\
t_1 := \left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5\\
\mathbf{if}\;b \leq 0.155:\\
\;\;\;\;\left(t_0 - b \cdot b\right) \cdot \frac{1}{\left(a \cdot 2\right) \cdot \left(b + \sqrt{t_0}\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{2}{\mathsf{fma}\left(-4, \frac{\mathsf{fma}\left(-1, a \cdot \left(c \cdot t_1\right), \mathsf{fma}\left(-0.125, \frac{\mathsf{fma}\left(16, {a}^{4} \cdot {c}^{4}, {\left(-2 \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)\right)}^{2}\right)}{a \cdot \left(c \cdot c\right)}, \left(c \cdot c\right) \cdot {a}^{3}\right)\right)}{{b}^{5}}, \mathsf{fma}\left(-4, \frac{t_1}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \frac{a \cdot 2}{b}\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 0.154999999999999999

    1. Initial program 89.2%

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
    3. Step-by-step derivation
      1. un-div-inv89.2%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
      2. associate-*r*89.2%

        \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
      3. associate-*r*89.2%

        \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
      4. distribute-rgt-out--89.2%

        \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
      5. associate-/l*89.1%

        \[\leadsto \color{blue}{\frac{2}{\frac{4 \cdot \left(a \cdot a\right)}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}}} \]
      6. *-commutative89.1%

        \[\leadsto \frac{2}{\frac{\color{blue}{\left(a \cdot a\right) \cdot 4}}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}} \]
    4. Applied egg-rr89.6%

      \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
    5. Applied egg-rr90.8%

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

    if 0.154999999999999999 < b

    1. Initial program 51.1%

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
    3. Step-by-step derivation
      1. un-div-inv50.6%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
      2. associate-*r*50.6%

        \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
      3. associate-*r*50.6%

        \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
      4. distribute-rgt-out--50.6%

        \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
      5. associate-/l*50.6%

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

        \[\leadsto \frac{2}{\frac{\color{blue}{\left(a \cdot a\right) \cdot 4}}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}} \]
    4. Applied egg-rr50.6%

      \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
    5. Taylor expanded in b around inf 92.0%

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

      \[\leadsto \frac{2}{\color{blue}{\mathsf{fma}\left(-4, \frac{\mathsf{fma}\left(-1, a \cdot \left(c \cdot \left(\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5\right)\right), \mathsf{fma}\left(-0.125, \frac{\mathsf{fma}\left(16, {a}^{4} \cdot {c}^{4}, {\left(-2 \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)\right)}^{2}\right)}{a \cdot \left(c \cdot c\right)}, {a}^{3} \cdot \left(c \cdot c\right)\right)\right)}{{b}^{5}}, \mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \frac{a \cdot 2}{b}\right)\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.9%

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

Alternative 2: 91.5% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a \cdot -4, c, b \cdot b\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.105:\\ \;\;\;\;\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\frac{t_0 - b \cdot b}{\left(b + \sqrt{t_0}\right) \cdot \frac{1}{a}}}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-2, \langle \left( \langle \left( \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}} \right)_{\text{binary64}} \rangle_{\text{binary32}} \right)_{\text{binary32}} \rangle_{\text{binary64}}, \left(\frac{\mathsf{fma}\left(16, {a}^{4} \cdot {c}^{4}, {\left(-2 \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)\right)}^{2}\right) \cdot -0.25}{a \cdot {b}^{7}} - \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right) - \frac{c}{b}\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma (* a -4.0) c (* b b))))
   (if (<= (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) -0.105)
     (/
      2.0
      (/ (* (* a a) 4.0) (/ (- t_0 (* b b)) (* (+ b (sqrt t_0)) (/ 1.0 a)))))
     (fma
      -2.0
      (cast
       (!
        :precision
        binary32
        (cast
         (! :precision binary64 (/ (* a a) (/ (pow b 5.0) (pow c 3.0)))))))
      (-
       (-
        (/
         (*
          (fma
           16.0
           (* (pow a 4.0) (pow c 4.0))
           (pow (* -2.0 (* (* a a) (* c c))) 2.0))
          -0.25)
         (* a (pow b 7.0)))
        (/ a (/ (pow b 3.0) (* c c))))
       (/ c b))))))
double code(double a, double b, double c) {
	double t_0 = fma((a * -4.0), c, (b * b));
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -0.105) {
		tmp = 2.0 / (((a * a) * 4.0) / ((t_0 - (b * b)) / ((b + sqrt(t_0)) * (1.0 / a))));
	} else {
		double tmp_3 = (a * a) / (pow(b, 5.0) / pow(c, 3.0));
		double tmp_2 = (float) tmp_3;
		tmp = fma(-2.0, ((double) tmp_2), ((((fma(16.0, (pow(a, 4.0) * pow(c, 4.0)), pow((-2.0 * ((a * a) * (c * c))), 2.0)) * -0.25) / (a * pow(b, 7.0))) - (a / (pow(b, 3.0) / (c * c)))) - (c / b)));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(Float64(a * -4.0), c, Float64(b * b))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) <= -0.105)
		tmp = Float64(2.0 / Float64(Float64(Float64(a * a) * 4.0) / Float64(Float64(t_0 - Float64(b * b)) / Float64(Float64(b + sqrt(t_0)) * Float64(1.0 / a)))));
	else
		tmp_3 = Float64(Float64(a * a) / Float64((b ^ 5.0) / (c ^ 3.0)))
		tmp_2 = Float32(tmp_3)
		tmp = fma(-2.0, Float64(tmp_2), Float64(Float64(Float64(Float64(fma(16.0, Float64((a ^ 4.0) * (c ^ 4.0)), (Float64(-2.0 * Float64(Float64(a * a) * Float64(c * c))) ^ 2.0)) * -0.25) / Float64(a * (b ^ 7.0))) - Float64(a / Float64((b ^ 3.0) / Float64(c * c)))) - Float64(c / b)));
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a \cdot -4, c, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.105:\\
\;\;\;\;\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\frac{t_0 - b \cdot b}{\left(b + \sqrt{t_0}\right) \cdot \frac{1}{a}}}}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-2, \langle \left( \langle \left( \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}} \right)_{\text{binary64}} \rangle_{\text{binary32}} \right)_{\text{binary32}} \rangle_{\text{binary64}}, \left(\frac{\mathsf{fma}\left(16, {a}^{4} \cdot {c}^{4}, {\left(-2 \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)\right)}^{2}\right) \cdot -0.25}{a \cdot {b}^{7}} - \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right) - \frac{c}{b}\right)\\


\end{array}
\end{array}
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.104999999999999996

    1. Initial program 82.6%

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
    3. Step-by-step derivation
      1. un-div-inv82.2%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
      2. associate-*r*82.2%

        \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
      3. associate-*r*82.2%

        \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
      4. distribute-rgt-out--82.2%

        \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
      5. associate-/l*82.1%

        \[\leadsto \color{blue}{\frac{2}{\frac{4 \cdot \left(a \cdot a\right)}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}}} \]
      6. *-commutative82.1%

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

      \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
    5. Step-by-step derivation
      1. distribute-lft-out--82.6%

        \[\leadsto \frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\color{blue}{a \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}}} \]
      2. remove-double-div82.6%

        \[\leadsto \frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\color{blue}{\frac{1}{\frac{1}{a}}} \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}} \]
      3. flip--82.7%

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

        \[\leadsto \frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\color{blue}{\frac{1 \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b \cdot b\right)}{\frac{1}{a} \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} + b\right)}}}} \]
    6. Applied egg-rr84.1%

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

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

    1. Initial program 45.7%

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

      \[\leadsto \color{blue}{-2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-1 \cdot \frac{c}{b} + \left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.25 \cdot \frac{16 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-2 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right)} \]
    3. Step-by-step derivation
      1. fma-def94.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-2, \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}}, -1 \cdot \frac{c}{b} + \left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.25 \cdot \frac{16 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-2 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right)} \]
      2. associate-/l*94.3%

        \[\leadsto \mathsf{fma}\left(-2, \color{blue}{\frac{{a}^{2}}{\frac{{b}^{5}}{{c}^{3}}}}, -1 \cdot \frac{c}{b} + \left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.25 \cdot \frac{16 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-2 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right) \]
      3. unpow294.3%

        \[\leadsto \mathsf{fma}\left(-2, \frac{\color{blue}{a \cdot a}}{\frac{{b}^{5}}{{c}^{3}}}, -1 \cdot \frac{c}{b} + \left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.25 \cdot \frac{16 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-2 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right) \]
      4. +-commutative94.3%

        \[\leadsto \mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \color{blue}{\left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.25 \cdot \frac{16 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-2 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right) + -1 \cdot \frac{c}{b}}\right) \]
      5. mul-1-neg94.3%

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

        \[\leadsto \mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \color{blue}{\left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.25 \cdot \frac{16 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-2 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right) - \frac{c}{b}}\right) \]
    4. Simplified94.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \left(\frac{\mathsf{fma}\left(16, {a}^{4} \cdot {c}^{4}, {\left(-2 \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)\right)}^{2}\right) \cdot -0.25}{a \cdot {b}^{7}} - \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right) - \frac{c}{b}\right)} \]
    5. Step-by-step derivation
      1. rewrite-binary64/binary32-simplify94.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-2, \langle \left( \langle \left( \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}} \right)_{\text{binary64}} \rangle_{\text{binary32}} \right)_{\text{binary32}} \rangle_{\text{binary64}}, \left(\frac{\mathsf{fma}\left(16, {a}^{4} \cdot {c}^{4}, {\left(-2 \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)\right)}^{2}\right) \cdot -0.25}{a \cdot {b}^{7}} - \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right) - \frac{c}{b}\right)} \]
    6. Applied rewrite-once94.3%

      \[\leadsto \mathsf{fma}\left(-2, \color{blue}{\langle \color{blue}{\left( \color{blue}{\langle \color{blue}{\left( \color{blue}{\frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}} \right)_{\text{binary64}}} \rangle_{\text{binary32}}} \right)_{\text{binary32}}} \rangle_{\text{binary64}}}, \left(\frac{\mathsf{fma}\left(16, {a}^{4} \cdot {c}^{4}, {\left(-2 \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)\right)}^{2}\right) \cdot -0.25}{a \cdot {b}^{7}} - \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right) - \frac{c}{b}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.105:\\ \;\;\;\;\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\frac{\mathsf{fma}\left(a \cdot -4, c, b \cdot b\right) - b \cdot b}{\left(b + \sqrt{\mathsf{fma}\left(a \cdot -4, c, b \cdot b\right)}\right) \cdot \frac{1}{a}}}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-2, \langle \left( \langle \left( \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}} \right)_{\text{binary64}} \rangle_{\text{binary32}} \right)_{\text{binary32}} \rangle_{\text{binary64}}, \left(\frac{\mathsf{fma}\left(16, {a}^{4} \cdot {c}^{4}, {\left(-2 \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)\right)}^{2}\right) \cdot -0.25}{a \cdot {b}^{7}} - \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right) - \frac{c}{b}\right)\\ \end{array} \]

Alternative 3: 91.5% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a \cdot -4, c, b \cdot b\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.105:\\ \;\;\;\;\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\frac{t_0 - b \cdot b}{\left(b + \sqrt{t_0}\right) \cdot \frac{1}{a}}}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \left(\frac{-0.25 \cdot \left({a}^{3} \cdot \left({c}^{4} \cdot 20\right)\right)}{{b}^{7}} - \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right) - \frac{c}{b}\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma (* a -4.0) c (* b b))))
   (if (<= (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) -0.105)
     (/
      2.0
      (/ (* (* a a) 4.0) (/ (- t_0 (* b b)) (* (+ b (sqrt t_0)) (/ 1.0 a)))))
     (fma
      -2.0
      (/ (* a a) (/ (pow b 5.0) (pow c 3.0)))
      (-
       (-
        (/ (* -0.25 (* (pow a 3.0) (* (pow c 4.0) 20.0))) (pow b 7.0))
        (/ a (/ (pow b 3.0) (* c c))))
       (/ c b))))))
double code(double a, double b, double c) {
	double t_0 = fma((a * -4.0), c, (b * b));
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -0.105) {
		tmp = 2.0 / (((a * a) * 4.0) / ((t_0 - (b * b)) / ((b + sqrt(t_0)) * (1.0 / a))));
	} else {
		tmp = fma(-2.0, ((a * a) / (pow(b, 5.0) / pow(c, 3.0))), ((((-0.25 * (pow(a, 3.0) * (pow(c, 4.0) * 20.0))) / pow(b, 7.0)) - (a / (pow(b, 3.0) / (c * c)))) - (c / b)));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(Float64(a * -4.0), c, Float64(b * b))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) <= -0.105)
		tmp = Float64(2.0 / Float64(Float64(Float64(a * a) * 4.0) / Float64(Float64(t_0 - Float64(b * b)) / Float64(Float64(b + sqrt(t_0)) * Float64(1.0 / a)))));
	else
		tmp = fma(-2.0, Float64(Float64(a * a) / Float64((b ^ 5.0) / (c ^ 3.0))), Float64(Float64(Float64(Float64(-0.25 * Float64((a ^ 3.0) * Float64((c ^ 4.0) * 20.0))) / (b ^ 7.0)) - Float64(a / Float64((b ^ 3.0) / Float64(c * c)))) - Float64(c / b)));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(a * -4.0), $MachinePrecision] * c + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -0.105], N[(2.0 / N[(N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision] / N[(N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision] / N[(N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] * N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(a * a), $MachinePrecision] / N[(N[Power[b, 5.0], $MachinePrecision] / N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(-0.25 * N[(N[Power[a, 3.0], $MachinePrecision] * N[(N[Power[c, 4.0], $MachinePrecision] * 20.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision] - N[(a / N[(N[Power[b, 3.0], $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a \cdot -4, c, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.105:\\
\;\;\;\;\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\frac{t_0 - b \cdot b}{\left(b + \sqrt{t_0}\right) \cdot \frac{1}{a}}}}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \left(\frac{-0.25 \cdot \left({a}^{3} \cdot \left({c}^{4} \cdot 20\right)\right)}{{b}^{7}} - \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right) - \frac{c}{b}\right)\\


\end{array}
\end{array}
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.104999999999999996

    1. Initial program 82.6%

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
    3. Step-by-step derivation
      1. un-div-inv82.2%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
      2. associate-*r*82.2%

        \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
      3. associate-*r*82.2%

        \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
      4. distribute-rgt-out--82.2%

        \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
      5. associate-/l*82.1%

        \[\leadsto \color{blue}{\frac{2}{\frac{4 \cdot \left(a \cdot a\right)}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}}} \]
      6. *-commutative82.1%

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

      \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
    5. Step-by-step derivation
      1. distribute-lft-out--82.6%

        \[\leadsto \frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\color{blue}{a \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}}} \]
      2. remove-double-div82.6%

        \[\leadsto \frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\color{blue}{\frac{1}{\frac{1}{a}}} \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}} \]
      3. flip--82.7%

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

        \[\leadsto \frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\color{blue}{\frac{1 \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b \cdot b\right)}{\frac{1}{a} \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} + b\right)}}}} \]
    6. Applied egg-rr84.1%

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

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

    1. Initial program 45.7%

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

      \[\leadsto \color{blue}{-2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-1 \cdot \frac{c}{b} + \left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.25 \cdot \frac{16 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-2 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right)} \]
    3. Step-by-step derivation
      1. fma-def94.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-2, \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}}, -1 \cdot \frac{c}{b} + \left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.25 \cdot \frac{16 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-2 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right)} \]
      2. associate-/l*94.3%

        \[\leadsto \mathsf{fma}\left(-2, \color{blue}{\frac{{a}^{2}}{\frac{{b}^{5}}{{c}^{3}}}}, -1 \cdot \frac{c}{b} + \left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.25 \cdot \frac{16 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-2 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right) \]
      3. unpow294.3%

        \[\leadsto \mathsf{fma}\left(-2, \frac{\color{blue}{a \cdot a}}{\frac{{b}^{5}}{{c}^{3}}}, -1 \cdot \frac{c}{b} + \left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.25 \cdot \frac{16 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-2 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right) \]
      4. +-commutative94.3%

        \[\leadsto \mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \color{blue}{\left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.25 \cdot \frac{16 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-2 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right) + -1 \cdot \frac{c}{b}}\right) \]
      5. mul-1-neg94.3%

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

        \[\leadsto \mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \color{blue}{\left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.25 \cdot \frac{16 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-2 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right) - \frac{c}{b}}\right) \]
    4. Simplified94.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \left(\frac{\mathsf{fma}\left(16, {a}^{4} \cdot {c}^{4}, {\left(-2 \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)\right)}^{2}\right) \cdot -0.25}{a \cdot {b}^{7}} - \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right) - \frac{c}{b}\right)} \]
    5. Taylor expanded in a around 0 94.3%

      \[\leadsto \mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \left(\color{blue}{-0.25 \cdot \frac{{a}^{3} \cdot \left(4 \cdot {c}^{4} + 16 \cdot {c}^{4}\right)}{{b}^{7}}} - \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right) - \frac{c}{b}\right) \]
    6. Step-by-step derivation
      1. associate-*r/94.3%

        \[\leadsto \mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \left(\color{blue}{\frac{-0.25 \cdot \left({a}^{3} \cdot \left(4 \cdot {c}^{4} + 16 \cdot {c}^{4}\right)\right)}{{b}^{7}}} - \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right) - \frac{c}{b}\right) \]
      2. distribute-rgt-out94.3%

        \[\leadsto \mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \left(\frac{-0.25 \cdot \left({a}^{3} \cdot \color{blue}{\left({c}^{4} \cdot \left(4 + 16\right)\right)}\right)}{{b}^{7}} - \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right) - \frac{c}{b}\right) \]
      3. metadata-eval94.3%

        \[\leadsto \mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \left(\frac{-0.25 \cdot \left({a}^{3} \cdot \left({c}^{4} \cdot \color{blue}{20}\right)\right)}{{b}^{7}} - \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right) - \frac{c}{b}\right) \]
    7. Simplified94.3%

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

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

Alternative 4: 89.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a \cdot -4, c, b \cdot b\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.105:\\ \;\;\;\;\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\frac{t_0 - b \cdot b}{\left(b + \sqrt{t_0}\right) \cdot \frac{1}{a}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \frac{a \cdot 2}{b}\right)\right)}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma (* a -4.0) c (* b b))))
   (if (<= (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) -0.105)
     (/
      2.0
      (/ (* (* a a) 4.0) (/ (- t_0 (* b b)) (* (+ b (sqrt t_0)) (/ 1.0 a)))))
     (/
      2.0
      (fma
       -4.0
       (/ (* (* c (* a a)) -0.5) (pow b 3.0))
       (fma -2.0 (/ b c) (/ (* a 2.0) b)))))))
double code(double a, double b, double c) {
	double t_0 = fma((a * -4.0), c, (b * b));
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -0.105) {
		tmp = 2.0 / (((a * a) * 4.0) / ((t_0 - (b * b)) / ((b + sqrt(t_0)) * (1.0 / a))));
	} else {
		tmp = 2.0 / fma(-4.0, (((c * (a * a)) * -0.5) / pow(b, 3.0)), fma(-2.0, (b / c), ((a * 2.0) / b)));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(Float64(a * -4.0), c, Float64(b * b))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) <= -0.105)
		tmp = Float64(2.0 / Float64(Float64(Float64(a * a) * 4.0) / Float64(Float64(t_0 - Float64(b * b)) / Float64(Float64(b + sqrt(t_0)) * Float64(1.0 / a)))));
	else
		tmp = Float64(2.0 / fma(-4.0, Float64(Float64(Float64(c * Float64(a * a)) * -0.5) / (b ^ 3.0)), fma(-2.0, Float64(b / c), Float64(Float64(a * 2.0) / b))));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(a * -4.0), $MachinePrecision] * c + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -0.105], N[(2.0 / N[(N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision] / N[(N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision] / N[(N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] * N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(-4.0 * N[(N[(N[(c * N[(a * a), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(b / c), $MachinePrecision] + N[(N[(a * 2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a \cdot -4, c, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.105:\\
\;\;\;\;\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\frac{t_0 - b \cdot b}{\left(b + \sqrt{t_0}\right) \cdot \frac{1}{a}}}}\\

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


\end{array}
\end{array}
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.104999999999999996

    1. Initial program 82.6%

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
    3. Step-by-step derivation
      1. un-div-inv82.2%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
      2. associate-*r*82.2%

        \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
      3. associate-*r*82.2%

        \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
      4. distribute-rgt-out--82.2%

        \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
      5. associate-/l*82.1%

        \[\leadsto \color{blue}{\frac{2}{\frac{4 \cdot \left(a \cdot a\right)}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}}} \]
      6. *-commutative82.1%

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

      \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
    5. Step-by-step derivation
      1. distribute-lft-out--82.6%

        \[\leadsto \frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\color{blue}{a \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}}} \]
      2. remove-double-div82.6%

        \[\leadsto \frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\color{blue}{\frac{1}{\frac{1}{a}}} \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}} \]
      3. flip--82.7%

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

        \[\leadsto \frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{\color{blue}{\frac{1 \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b \cdot b\right)}{\frac{1}{a} \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} + b\right)}}}} \]
    6. Applied egg-rr84.1%

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

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

    1. Initial program 45.7%

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
    3. Step-by-step derivation
      1. un-div-inv45.3%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
      2. associate-*r*45.3%

        \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
      3. associate-*r*45.3%

        \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
      4. distribute-rgt-out--45.3%

        \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
      5. associate-/l*45.3%

        \[\leadsto \color{blue}{\frac{2}{\frac{4 \cdot \left(a \cdot a\right)}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}}} \]
      6. *-commutative45.3%

        \[\leadsto \frac{2}{\frac{\color{blue}{\left(a \cdot a\right) \cdot 4}}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}} \]
    4. Applied egg-rr45.3%

      \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
    5. Taylor expanded in b around inf 92.4%

      \[\leadsto \frac{2}{\color{blue}{-4 \cdot \frac{-1 \cdot \left({a}^{2} \cdot c\right) + 0.5 \cdot \left({a}^{2} \cdot c\right)}{{b}^{3}} + \left(-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)}} \]
    6. Step-by-step derivation
      1. fma-def92.4%

        \[\leadsto \frac{2}{\color{blue}{\mathsf{fma}\left(-4, \frac{-1 \cdot \left({a}^{2} \cdot c\right) + 0.5 \cdot \left({a}^{2} \cdot c\right)}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)}} \]
      2. distribute-rgt-out92.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\color{blue}{\left({a}^{2} \cdot c\right) \cdot \left(-1 + 0.5\right)}}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)} \]
      3. *-commutative92.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\color{blue}{\left(c \cdot {a}^{2}\right)} \cdot \left(-1 + 0.5\right)}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)} \]
      4. unpow292.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(-1 + 0.5\right)}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)} \]
      5. metadata-eval92.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{-0.5}}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)} \]
      6. fma-def92.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \color{blue}{\mathsf{fma}\left(-2, \frac{b}{c}, 2 \cdot \frac{a}{b}\right)}\right)} \]
      7. associate-*r/92.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \color{blue}{\frac{2 \cdot a}{b}}\right)\right)} \]
      8. *-commutative92.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \frac{\color{blue}{a \cdot 2}}{b}\right)\right)} \]
    7. Simplified92.4%

      \[\leadsto \frac{2}{\color{blue}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \frac{a \cdot 2}{b}\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.4%

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

Alternative 5: 88.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a \cdot -4, c, b \cdot b\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.0014:\\ \;\;\;\;\left(t_0 - b \cdot b\right) \cdot \frac{1}{\left(a \cdot 2\right) \cdot \left(b + \sqrt{t_0}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \frac{a \cdot 2}{b}\right)\right)}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma (* a -4.0) c (* b b))))
   (if (<= (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) -0.0014)
     (* (- t_0 (* b b)) (/ 1.0 (* (* a 2.0) (+ b (sqrt t_0)))))
     (/
      2.0
      (fma
       -4.0
       (/ (* (* c (* a a)) -0.5) (pow b 3.0))
       (fma -2.0 (/ b c) (/ (* a 2.0) b)))))))
double code(double a, double b, double c) {
	double t_0 = fma((a * -4.0), c, (b * b));
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -0.0014) {
		tmp = (t_0 - (b * b)) * (1.0 / ((a * 2.0) * (b + sqrt(t_0))));
	} else {
		tmp = 2.0 / fma(-4.0, (((c * (a * a)) * -0.5) / pow(b, 3.0)), fma(-2.0, (b / c), ((a * 2.0) / b)));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(Float64(a * -4.0), c, Float64(b * b))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) <= -0.0014)
		tmp = Float64(Float64(t_0 - Float64(b * b)) * Float64(1.0 / Float64(Float64(a * 2.0) * Float64(b + sqrt(t_0)))));
	else
		tmp = Float64(2.0 / fma(-4.0, Float64(Float64(Float64(c * Float64(a * a)) * -0.5) / (b ^ 3.0)), fma(-2.0, Float64(b / c), Float64(Float64(a * 2.0) / b))));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(a * -4.0), $MachinePrecision] * c + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -0.0014], N[(N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(N[(a * 2.0), $MachinePrecision] * N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(-4.0 * N[(N[(N[(c * N[(a * a), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(b / c), $MachinePrecision] + N[(N[(a * 2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a \cdot -4, c, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.0014:\\
\;\;\;\;\left(t_0 - b \cdot b\right) \cdot \frac{1}{\left(a \cdot 2\right) \cdot \left(b + \sqrt{t_0}\right)}\\

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


\end{array}
\end{array}
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.00139999999999999999

    1. Initial program 79.8%

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
    3. Step-by-step derivation
      1. un-div-inv79.2%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
      2. associate-*r*79.2%

        \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
      3. associate-*r*79.2%

        \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
      4. distribute-rgt-out--79.2%

        \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
      5. associate-/l*79.2%

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

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

      \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
    5. Applied egg-rr81.4%

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

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

    1. Initial program 42.4%

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
    3. Step-by-step derivation
      1. un-div-inv42.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
      2. associate-*r*42.0%

        \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
      3. associate-*r*42.0%

        \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
      4. distribute-rgt-out--42.0%

        \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
      5. associate-/l*42.0%

        \[\leadsto \color{blue}{\frac{2}{\frac{4 \cdot \left(a \cdot a\right)}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}}} \]
      6. *-commutative42.0%

        \[\leadsto \frac{2}{\frac{\color{blue}{\left(a \cdot a\right) \cdot 4}}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}} \]
    4. Applied egg-rr42.0%

      \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
    5. Taylor expanded in b around inf 94.8%

      \[\leadsto \frac{2}{\color{blue}{-4 \cdot \frac{-1 \cdot \left({a}^{2} \cdot c\right) + 0.5 \cdot \left({a}^{2} \cdot c\right)}{{b}^{3}} + \left(-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)}} \]
    6. Step-by-step derivation
      1. fma-def94.8%

        \[\leadsto \frac{2}{\color{blue}{\mathsf{fma}\left(-4, \frac{-1 \cdot \left({a}^{2} \cdot c\right) + 0.5 \cdot \left({a}^{2} \cdot c\right)}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)}} \]
      2. distribute-rgt-out94.8%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\color{blue}{\left({a}^{2} \cdot c\right) \cdot \left(-1 + 0.5\right)}}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)} \]
      3. *-commutative94.8%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\color{blue}{\left(c \cdot {a}^{2}\right)} \cdot \left(-1 + 0.5\right)}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)} \]
      4. unpow294.8%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(-1 + 0.5\right)}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)} \]
      5. metadata-eval94.8%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{-0.5}}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)} \]
      6. fma-def94.8%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \color{blue}{\mathsf{fma}\left(-2, \frac{b}{c}, 2 \cdot \frac{a}{b}\right)}\right)} \]
      7. associate-*r/94.8%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \color{blue}{\frac{2 \cdot a}{b}}\right)\right)} \]
      8. *-commutative94.8%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \frac{\color{blue}{a \cdot 2}}{b}\right)\right)} \]
    7. Simplified94.8%

      \[\leadsto \frac{2}{\color{blue}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \frac{a \cdot 2}{b}\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.4%

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

Alternative 6: 89.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.105:\\ \;\;\;\;\frac{2}{\frac{4 \cdot \left(-a\right)}{b - \sqrt{\mathsf{fma}\left(b, b, \left(a \cdot -4\right) \cdot c\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \frac{a \cdot 2}{b}\right)\right)}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) -0.105)
   (/ 2.0 (/ (* 4.0 (- a)) (- b (sqrt (fma b b (* (* a -4.0) c))))))
   (/
    2.0
    (fma
     -4.0
     (/ (* (* c (* a a)) -0.5) (pow b 3.0))
     (fma -2.0 (/ b c) (/ (* a 2.0) b))))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -0.105) {
		tmp = 2.0 / ((4.0 * -a) / (b - sqrt(fma(b, b, ((a * -4.0) * c)))));
	} else {
		tmp = 2.0 / fma(-4.0, (((c * (a * a)) * -0.5) / pow(b, 3.0)), fma(-2.0, (b / c), ((a * 2.0) / b)));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) <= -0.105)
		tmp = Float64(2.0 / Float64(Float64(4.0 * Float64(-a)) / Float64(b - sqrt(fma(b, b, Float64(Float64(a * -4.0) * c))))));
	else
		tmp = Float64(2.0 / fma(-4.0, Float64(Float64(Float64(c * Float64(a * a)) * -0.5) / (b ^ 3.0)), fma(-2.0, Float64(b / c), Float64(Float64(a * 2.0) / b))));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -0.105], N[(2.0 / N[(N[(4.0 * (-a)), $MachinePrecision] / N[(b - N[Sqrt[N[(b * b + N[(N[(a * -4.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(-4.0 * N[(N[(N[(c * N[(a * a), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(b / c), $MachinePrecision] + N[(N[(a * 2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.105:\\
\;\;\;\;\frac{2}{\frac{4 \cdot \left(-a\right)}{b - \sqrt{\mathsf{fma}\left(b, b, \left(a \cdot -4\right) \cdot c\right)}}}\\

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


\end{array}
\end{array}
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.104999999999999996

    1. Initial program 82.6%

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
    3. Step-by-step derivation
      1. un-div-inv82.2%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
      2. associate-*r*82.2%

        \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
      3. associate-*r*82.2%

        \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
      4. distribute-rgt-out--82.2%

        \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
      5. associate-/l*82.1%

        \[\leadsto \color{blue}{\frac{2}{\frac{4 \cdot \left(a \cdot a\right)}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}}} \]
      6. *-commutative82.1%

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

      \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
    5. Step-by-step derivation
      1. remove-double-neg82.4%

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

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

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

        \[\leadsto \frac{2}{0 - \left(-\color{blue}{\left(-\frac{\left(a \cdot a\right) \cdot 4}{-\left(a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b\right)}\right)}\right)} \]
      5. remove-double-neg82.4%

        \[\leadsto \frac{2}{0 - \color{blue}{\frac{\left(a \cdot a\right) \cdot 4}{-\left(a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b\right)}}} \]
      6. distribute-lft-out--82.6%

        \[\leadsto \frac{2}{0 - \frac{\left(a \cdot a\right) \cdot 4}{-\color{blue}{a \cdot \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}}} \]
      7. distribute-rgt-neg-in82.6%

        \[\leadsto \frac{2}{0 - \frac{\left(a \cdot a\right) \cdot 4}{\color{blue}{a \cdot \left(-\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)\right)}}} \]
      8. associate-/r*82.7%

        \[\leadsto \frac{2}{0 - \color{blue}{\frac{\frac{\left(a \cdot a\right) \cdot 4}{a}}{-\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}}} \]
      9. associate-*l*82.7%

        \[\leadsto \frac{2}{0 - \frac{\frac{\color{blue}{a \cdot \left(a \cdot 4\right)}}{a}}{-\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}} \]
      10. *-commutative82.7%

        \[\leadsto \frac{2}{0 - \frac{\frac{\color{blue}{\left(a \cdot 4\right) \cdot a}}{a}}{-\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}} \]
      11. associate-/l*82.7%

        \[\leadsto \frac{2}{0 - \frac{\color{blue}{\frac{a \cdot 4}{\frac{a}{a}}}}{-\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}} \]
      12. *-inverses82.7%

        \[\leadsto \frac{2}{0 - \frac{\frac{a \cdot 4}{\color{blue}{1}}}{-\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}} \]
      13. /-rgt-identity82.7%

        \[\leadsto \frac{2}{0 - \frac{\color{blue}{a \cdot 4}}{-\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}} \]
      14. neg-sub082.7%

        \[\leadsto \frac{2}{0 - \frac{a \cdot 4}{\color{blue}{0 - \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}}} \]
    6. Applied egg-rr82.7%

      \[\leadsto \frac{2}{\color{blue}{0 - \frac{a \cdot 4}{b - \sqrt{\mathsf{fma}\left(a \cdot -4, c, b \cdot b\right)}}}} \]
    7. Step-by-step derivation
      1. sub0-neg82.7%

        \[\leadsto \frac{2}{\color{blue}{-\frac{a \cdot 4}{b - \sqrt{\mathsf{fma}\left(a \cdot -4, c, b \cdot b\right)}}}} \]
      2. distribute-neg-frac82.7%

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

        \[\leadsto \frac{2}{\frac{-a \cdot 4}{b - \sqrt{\color{blue}{\left(a \cdot -4\right) \cdot c + b \cdot b}}}} \]
      4. *-commutative82.6%

        \[\leadsto \frac{2}{\frac{-a \cdot 4}{b - \sqrt{\color{blue}{\left(-4 \cdot a\right)} \cdot c + b \cdot b}}} \]
      5. associate-*r*82.6%

        \[\leadsto \frac{2}{\frac{-a \cdot 4}{b - \sqrt{\color{blue}{-4 \cdot \left(a \cdot c\right)} + b \cdot b}}} \]
      6. unpow282.6%

        \[\leadsto \frac{2}{\frac{-a \cdot 4}{b - \sqrt{-4 \cdot \left(a \cdot c\right) + \color{blue}{{b}^{2}}}}} \]
      7. +-commutative82.6%

        \[\leadsto \frac{2}{\frac{-a \cdot 4}{b - \sqrt{\color{blue}{{b}^{2} + -4 \cdot \left(a \cdot c\right)}}}} \]
      8. unpow282.6%

        \[\leadsto \frac{2}{\frac{-a \cdot 4}{b - \sqrt{\color{blue}{b \cdot b} + -4 \cdot \left(a \cdot c\right)}}} \]
      9. associate-*r*82.6%

        \[\leadsto \frac{2}{\frac{-a \cdot 4}{b - \sqrt{b \cdot b + \color{blue}{\left(-4 \cdot a\right) \cdot c}}}} \]
      10. *-commutative82.6%

        \[\leadsto \frac{2}{\frac{-a \cdot 4}{b - \sqrt{b \cdot b + \color{blue}{\left(a \cdot -4\right)} \cdot c}}} \]
      11. *-commutative82.6%

        \[\leadsto \frac{2}{\frac{-a \cdot 4}{b - \sqrt{b \cdot b + \color{blue}{c \cdot \left(a \cdot -4\right)}}}} \]
      12. fma-udef82.9%

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

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

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

    1. Initial program 45.7%

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
    3. Step-by-step derivation
      1. un-div-inv45.3%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
      2. associate-*r*45.3%

        \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
      3. associate-*r*45.3%

        \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
      4. distribute-rgt-out--45.3%

        \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
      5. associate-/l*45.3%

        \[\leadsto \color{blue}{\frac{2}{\frac{4 \cdot \left(a \cdot a\right)}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}}} \]
      6. *-commutative45.3%

        \[\leadsto \frac{2}{\frac{\color{blue}{\left(a \cdot a\right) \cdot 4}}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}} \]
    4. Applied egg-rr45.3%

      \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
    5. Taylor expanded in b around inf 92.4%

      \[\leadsto \frac{2}{\color{blue}{-4 \cdot \frac{-1 \cdot \left({a}^{2} \cdot c\right) + 0.5 \cdot \left({a}^{2} \cdot c\right)}{{b}^{3}} + \left(-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)}} \]
    6. Step-by-step derivation
      1. fma-def92.4%

        \[\leadsto \frac{2}{\color{blue}{\mathsf{fma}\left(-4, \frac{-1 \cdot \left({a}^{2} \cdot c\right) + 0.5 \cdot \left({a}^{2} \cdot c\right)}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)}} \]
      2. distribute-rgt-out92.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\color{blue}{\left({a}^{2} \cdot c\right) \cdot \left(-1 + 0.5\right)}}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)} \]
      3. *-commutative92.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\color{blue}{\left(c \cdot {a}^{2}\right)} \cdot \left(-1 + 0.5\right)}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)} \]
      4. unpow292.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(-1 + 0.5\right)}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)} \]
      5. metadata-eval92.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot \color{blue}{-0.5}}{{b}^{3}}, -2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}\right)} \]
      6. fma-def92.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \color{blue}{\mathsf{fma}\left(-2, \frac{b}{c}, 2 \cdot \frac{a}{b}\right)}\right)} \]
      7. associate-*r/92.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \color{blue}{\frac{2 \cdot a}{b}}\right)\right)} \]
      8. *-commutative92.4%

        \[\leadsto \frac{2}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \frac{\color{blue}{a \cdot 2}}{b}\right)\right)} \]
    7. Simplified92.4%

      \[\leadsto \frac{2}{\color{blue}{\mathsf{fma}\left(-4, \frac{\left(c \cdot \left(a \cdot a\right)\right) \cdot -0.5}{{b}^{3}}, \mathsf{fma}\left(-2, \frac{b}{c}, \frac{a \cdot 2}{b}\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.1%

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

Alternative 7: 85.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.0014:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, \left(a \cdot -4\right) \cdot c\right)}\right) \cdot \frac{-0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) -0.0014)
   (* (- b (sqrt (fma b b (* (* a -4.0) c)))) (/ -0.5 a))
   (/ 2.0 (+ (* -2.0 (/ b c)) (* 2.0 (/ a b))))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -0.0014) {
		tmp = (b - sqrt(fma(b, b, ((a * -4.0) * c)))) * (-0.5 / a);
	} else {
		tmp = 2.0 / ((-2.0 * (b / c)) + (2.0 * (a / b)));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) <= -0.0014)
		tmp = Float64(Float64(b - sqrt(fma(b, b, Float64(Float64(a * -4.0) * c)))) * Float64(-0.5 / a));
	else
		tmp = Float64(2.0 / Float64(Float64(-2.0 * Float64(b / c)) + Float64(2.0 * Float64(a / b))));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -0.0014], N[(N[(b - N[Sqrt[N[(b * b + N[(N[(a * -4.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.0014:\\
\;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, \left(a \cdot -4\right) \cdot c\right)}\right) \cdot \frac{-0.5}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{2}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}}\\


\end{array}
\end{array}
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.00139999999999999999

    1. Initial program 79.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative79.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
      2. frac-2neg79.8%

        \[\leadsto \color{blue}{\frac{-\left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}{-a \cdot 2}} \]
      3. div-inv79.8%

        \[\leadsto \color{blue}{\left(-\left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \cdot \frac{1}{-a \cdot 2}} \]
      4. *-commutative79.8%

        \[\leadsto \color{blue}{\frac{1}{-a \cdot 2} \cdot \left(-\left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right)} \]
      5. *-commutative79.8%

        \[\leadsto \frac{1}{-\color{blue}{2 \cdot a}} \cdot \left(-\left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \]
      6. distribute-lft-neg-in79.8%

        \[\leadsto \frac{1}{\color{blue}{\left(-2\right) \cdot a}} \cdot \left(-\left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \]
      7. associate-/r*79.8%

        \[\leadsto \color{blue}{\frac{\frac{1}{-2}}{a}} \cdot \left(-\left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \]
      8. metadata-eval79.8%

        \[\leadsto \frac{\frac{1}{\color{blue}{-2}}}{a} \cdot \left(-\left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \]
      9. metadata-eval79.8%

        \[\leadsto \frac{\color{blue}{-0.5}}{a} \cdot \left(-\left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right) \]
      10. distribute-neg-in79.8%

        \[\leadsto \frac{-0.5}{a} \cdot \color{blue}{\left(\left(-\left(-b\right)\right) + \left(-\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\right)} \]
      11. fma-neg80.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(\left(-\left(-b\right)\right) + \left(-\sqrt{\color{blue}{\mathsf{fma}\left(b, b, -\left(4 \cdot a\right) \cdot c\right)}}\right)\right) \]
      12. associate-*l*80.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(\left(-\left(-b\right)\right) + \left(-\sqrt{\mathsf{fma}\left(b, b, -\color{blue}{4 \cdot \left(a \cdot c\right)}\right)}\right)\right) \]
      13. distribute-lft-neg-in80.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(\left(-\left(-b\right)\right) + \left(-\sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(-4\right) \cdot \left(a \cdot c\right)}\right)}\right)\right) \]
      14. metadata-eval80.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(\left(-\left(-b\right)\right) + \left(-\sqrt{\mathsf{fma}\left(b, b, \color{blue}{-4} \cdot \left(a \cdot c\right)\right)}\right)\right) \]
      15. *-commutative80.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(\left(-\left(-b\right)\right) + \left(-\sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(a \cdot c\right) \cdot -4}\right)}\right)\right) \]
      16. associate-*r*80.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(\left(-\left(-b\right)\right) + \left(-\sqrt{\mathsf{fma}\left(b, b, \color{blue}{a \cdot \left(c \cdot -4\right)}\right)}\right)\right) \]
    3. Applied egg-rr80.0%

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

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

    1. Initial program 42.4%

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
    3. Step-by-step derivation
      1. un-div-inv42.0%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
      2. associate-*r*42.0%

        \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
      3. associate-*r*42.0%

        \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
      4. distribute-rgt-out--42.0%

        \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
      5. associate-/l*42.0%

        \[\leadsto \color{blue}{\frac{2}{\frac{4 \cdot \left(a \cdot a\right)}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}}} \]
      6. *-commutative42.0%

        \[\leadsto \frac{2}{\frac{\color{blue}{\left(a \cdot a\right) \cdot 4}}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}} \]
    4. Applied egg-rr42.0%

      \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
    5. Taylor expanded in a around 0 90.8%

      \[\leadsto \frac{2}{\color{blue}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.0014:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, \left(a \cdot -4\right) \cdot c\right)}\right) \cdot \frac{-0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}}\\ \end{array} \]

Alternative 8: 85.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.0014:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(-4 \cdot c\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) -0.0014)
   (/ (- (sqrt (fma b b (* a (* -4.0 c)))) b) (* a 2.0))
   (/ 2.0 (+ (* -2.0 (/ b c)) (* 2.0 (/ a b))))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -0.0014) {
		tmp = (sqrt(fma(b, b, (a * (-4.0 * c)))) - b) / (a * 2.0);
	} else {
		tmp = 2.0 / ((-2.0 * (b / c)) + (2.0 * (a / b)));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) <= -0.0014)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(-4.0 * c)))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(2.0 / Float64(Float64(-2.0 * Float64(b / c)) + Float64(2.0 * Float64(a / b))));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -0.0014], N[(N[(N[Sqrt[N[(b * b + N[(a * N[(-4.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.0014:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(-4 \cdot c\right)\right)} - b}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{2}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}}\\


\end{array}
\end{array}
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.00139999999999999999

    1. Initial program 79.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. Simplified80.1%

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

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

      1. Initial program 42.4%

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

        \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
      3. Step-by-step derivation
        1. un-div-inv42.0%

          \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
        2. associate-*r*42.0%

          \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
        3. associate-*r*42.0%

          \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
        4. distribute-rgt-out--42.0%

          \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
        5. associate-/l*42.0%

          \[\leadsto \color{blue}{\frac{2}{\frac{4 \cdot \left(a \cdot a\right)}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}}} \]
        6. *-commutative42.0%

          \[\leadsto \frac{2}{\frac{\color{blue}{\left(a \cdot a\right) \cdot 4}}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}} \]
      4. Applied egg-rr42.0%

        \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
      5. Taylor expanded in a around 0 90.8%

        \[\leadsto \frac{2}{\color{blue}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification87.3%

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

    Alternative 9: 85.2% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.0014:\\ \;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}}\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) -0.0014)
       (/ (- (sqrt (- (* b b) (* a (* c 4.0)))) b) (* a 2.0))
       (/ 2.0 (+ (* -2.0 (/ b c)) (* 2.0 (/ a b))))))
    double code(double a, double b, double c) {
    	double tmp;
    	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -0.0014) {
    		tmp = (sqrt(((b * b) - (a * (c * 4.0)))) - b) / (a * 2.0);
    	} else {
    		tmp = 2.0 / ((-2.0 * (b / c)) + (2.0 * (a / b)));
    	}
    	return tmp;
    }
    
    real(8) function code(a, b, c)
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: c
        real(8) :: tmp
        if (((sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)) <= (-0.0014d0)) then
            tmp = (sqrt(((b * b) - (a * (c * 4.0d0)))) - b) / (a * 2.0d0)
        else
            tmp = 2.0d0 / (((-2.0d0) * (b / c)) + (2.0d0 * (a / b)))
        end if
        code = tmp
    end function
    
    public static double code(double a, double b, double c) {
    	double tmp;
    	if (((Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -0.0014) {
    		tmp = (Math.sqrt(((b * b) - (a * (c * 4.0)))) - b) / (a * 2.0);
    	} else {
    		tmp = 2.0 / ((-2.0 * (b / c)) + (2.0 * (a / b)));
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	tmp = 0
    	if ((math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -0.0014:
    		tmp = (math.sqrt(((b * b) - (a * (c * 4.0)))) - b) / (a * 2.0)
    	else:
    		tmp = 2.0 / ((-2.0 * (b / c)) + (2.0 * (a / b)))
    	return tmp
    
    function code(a, b, c)
    	tmp = 0.0
    	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) <= -0.0014)
    		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(a * Float64(c * 4.0)))) - b) / Float64(a * 2.0));
    	else
    		tmp = Float64(2.0 / Float64(Float64(-2.0 * Float64(b / c)) + Float64(2.0 * Float64(a / b))));
    	end
    	return tmp
    end
    
    function tmp_2 = code(a, b, c)
    	tmp = 0.0;
    	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -0.0014)
    		tmp = (sqrt(((b * b) - (a * (c * 4.0)))) - b) / (a * 2.0);
    	else
    		tmp = 2.0 / ((-2.0 * (b / c)) + (2.0 * (a / b)));
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -0.0014], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(a * N[(c * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.0014:\\
    \;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)} - b}{a \cdot 2}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{2}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}}\\
    
    
    \end{array}
    \end{array}
    
    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.00139999999999999999

      1. Initial program 79.8%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Step-by-step derivation
        1. log1p-expm1-u_binary6453.5%

          \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\right)\right)} \]
      3. Applied rewrite-once53.5%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\right)\right)} \]
      4. Step-by-step derivation
        1. log1p-expm179.8%

          \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}} \]
        2. mul-1-neg79.8%

          \[\leadsto \frac{\color{blue}{-1 \cdot b} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
        3. +-commutative79.8%

          \[\leadsto \frac{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + -1 \cdot b}}{2 \cdot a} \]
        4. mul-1-neg79.8%

          \[\leadsto \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \color{blue}{\left(-b\right)}}{2 \cdot a} \]
        5. unsub-neg79.8%

          \[\leadsto \frac{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}}{2 \cdot a} \]
        6. *-commutative79.8%

          \[\leadsto \frac{\sqrt{b \cdot b - \color{blue}{\left(a \cdot 4\right)} \cdot c} - b}{2 \cdot a} \]
        7. associate-*r*79.8%

          \[\leadsto \frac{\sqrt{b \cdot b - \color{blue}{a \cdot \left(4 \cdot c\right)}} - b}{2 \cdot a} \]
        8. *-commutative79.8%

          \[\leadsto \frac{\sqrt{b \cdot b - a \cdot \color{blue}{\left(c \cdot 4\right)}} - b}{2 \cdot a} \]
        9. *-commutative79.8%

          \[\leadsto \frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)} - b}{\color{blue}{a \cdot 2}} \]
      5. Simplified79.8%

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

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

      1. Initial program 42.4%

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

        \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
      3. Step-by-step derivation
        1. un-div-inv42.0%

          \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
        2. associate-*r*42.0%

          \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
        3. associate-*r*42.0%

          \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
        4. distribute-rgt-out--42.0%

          \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
        5. associate-/l*42.0%

          \[\leadsto \color{blue}{\frac{2}{\frac{4 \cdot \left(a \cdot a\right)}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}}} \]
        6. *-commutative42.0%

          \[\leadsto \frac{2}{\frac{\color{blue}{\left(a \cdot a\right) \cdot 4}}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}} \]
      4. Applied egg-rr42.0%

        \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
      5. Taylor expanded in a around 0 90.8%

        \[\leadsto \frac{2}{\color{blue}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification87.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.0014:\\ \;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}}\\ \end{array} \]

    Alternative 10: 81.7% accurate, 8.9× speedup?

    \[\begin{array}{l} \\ \frac{2}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (/ 2.0 (+ (* -2.0 (/ b c)) (* 2.0 (/ a b)))))
    double code(double a, double b, double c) {
    	return 2.0 / ((-2.0 * (b / c)) + (2.0 * (a / b)));
    }
    
    real(8) function code(a, b, c)
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: c
        code = 2.0d0 / (((-2.0d0) * (b / c)) + (2.0d0 * (a / b)))
    end function
    
    public static double code(double a, double b, double c) {
    	return 2.0 / ((-2.0 * (b / c)) + (2.0 * (a / b)));
    }
    
    def code(a, b, c):
    	return 2.0 / ((-2.0 * (b / c)) + (2.0 * (a / b)))
    
    function code(a, b, c)
    	return Float64(2.0 / Float64(Float64(-2.0 * Float64(b / c)) + Float64(2.0 * Float64(a / b))))
    end
    
    function tmp = code(a, b, c)
    	tmp = 2.0 / ((-2.0 * (b / c)) + (2.0 * (a / b)));
    end
    
    code[a_, b_, c_] := N[(2.0 / N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{2}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}}
    \end{array}
    
    Derivation
    1. Initial program 54.7%

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)\right) \cdot \frac{1}{4 \cdot \left(a \cdot a\right)}} \]
    3. Step-by-step derivation
      1. un-div-inv54.2%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot \left(a \cdot 2\right) - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)}} \]
      2. associate-*r*54.2%

        \[\leadsto \frac{\color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2} - b \cdot \left(a \cdot 2\right)}{4 \cdot \left(a \cdot a\right)} \]
      3. associate-*r*54.2%

        \[\leadsto \frac{\left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a\right) \cdot 2 - \color{blue}{\left(b \cdot a\right) \cdot 2}}{4 \cdot \left(a \cdot a\right)} \]
      4. distribute-rgt-out--54.2%

        \[\leadsto \frac{\color{blue}{2 \cdot \left(\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a\right)}}{4 \cdot \left(a \cdot a\right)} \]
      5. associate-/l*54.2%

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

        \[\leadsto \frac{2}{\frac{\color{blue}{\left(a \cdot a\right) \cdot 4}}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} \cdot a - b \cdot a}} \]
    4. Applied egg-rr54.3%

      \[\leadsto \color{blue}{\frac{2}{\frac{\left(a \cdot a\right) \cdot 4}{a \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - a \cdot b}}} \]
    5. Taylor expanded in a around 0 80.7%

      \[\leadsto \frac{2}{\color{blue}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}}} \]
    6. Final simplification80.7%

      \[\leadsto \frac{2}{-2 \cdot \frac{b}{c} + 2 \cdot \frac{a}{b}} \]

    Alternative 11: 63.9% accurate, 29.0× speedup?

    \[\begin{array}{l} \\ \frac{-c}{b} \end{array} \]
    (FPCore (a b c) :precision binary64 (/ (- c) b))
    double code(double a, double b, double c) {
    	return -c / b;
    }
    
    real(8) function code(a, b, c)
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: c
        code = -c / b
    end function
    
    public static double code(double a, double b, double c) {
    	return -c / b;
    }
    
    def code(a, b, c):
    	return -c / b
    
    function code(a, b, c)
    	return Float64(Float64(-c) / b)
    end
    
    function tmp = code(a, b, c)
    	tmp = -c / b;
    end
    
    code[a_, b_, c_] := N[((-c) / b), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{-c}{b}
    \end{array}
    
    Derivation
    1. Initial program 54.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. associate-*r/64.4%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-164.4%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified64.4%

      \[\leadsto \color{blue}{\frac{-c}{b}} \]
    5. Final simplification64.4%

      \[\leadsto \frac{-c}{b} \]

    Reproduce

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