Quadratic roots, narrow range

Percentage Accurate: 56.1% → 99.3%
Time: 15.0s
Alternatives: 8
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 8 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.1% 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: 99.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \frac{1}{\frac{0.5}{c} \cdot \left(\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ 1.0 (* (/ 0.5 c) (- (- b) (sqrt (fma c (* a -4.0) (pow b 2.0)))))))
double code(double a, double b, double c) {
	return 1.0 / ((0.5 / c) * (-b - sqrt(fma(c, (a * -4.0), pow(b, 2.0)))));
}
function code(a, b, c)
	return Float64(1.0 / Float64(Float64(0.5 / c) * Float64(Float64(-b) - sqrt(fma(c, Float64(a * -4.0), (b ^ 2.0))))))
end
code[a_, b_, c_] := N[(1.0 / N[(N[(0.5 / c), $MachinePrecision] * N[((-b) - N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\frac{0.5}{c} \cdot \left(\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)}
\end{array}
Derivation
  1. Initial program 54.0%

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Applied egg-rr53.7%

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

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

    \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \frac{1}{\frac{1}{\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)}}}{\left(-b\right) - {\left(\frac{1}{\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)}\right)}^{-0.5}}}}{a \cdot 2} \]
  8. Step-by-step derivation
    1. unpow255.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}{\left(-b\right) - {\left(\frac{1}{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)}^{-0.5}}}}{a \cdot 2} \]
  10. Step-by-step derivation
    1. clear-num55.7%

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\frac{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}}}\right)}^{-1}} \]
  12. Step-by-step derivation
    1. unpow-155.7%

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

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

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

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

    \[\leadsto \frac{1}{\frac{0.5}{c} \cdot \left(\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)} \]
  16. Add Preprocessing

Alternative 2: 89.2% 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 -120:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(\frac{a}{b} - \frac{b}{c}\right) + \frac{{a}^{2}}{\frac{{b}^{3}}{c}}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) -120.0)
   (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* a 2.0))
   (/ 1.0 (+ (- (/ a b) (/ b c)) (/ (pow a 2.0) (/ (pow b 3.0) c))))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -120.0) {
		tmp = (sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (a * 2.0);
	} else {
		tmp = 1.0 / (((a / b) - (b / c)) + (pow(a, 2.0) / (pow(b, 3.0) / c)));
	}
	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)) <= -120.0)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(1.0 / Float64(Float64(Float64(a / b) - Float64(b / c)) + Float64((a ^ 2.0) / Float64((b ^ 3.0) / c))));
	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], -120.0], N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(N[Power[a, 2.0], $MachinePrecision] / N[(N[Power[b, 3.0], $MachinePrecision] / c), $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 -120:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(\frac{a}{b} - \frac{b}{c}\right) + \frac{{a}^{2}}{\frac{{b}^{3}}{c}}}\\


\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)) < -120

    1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 51.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Applied egg-rr51.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}{\left(-b\right) - {\left(\frac{1}{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)}^{-0.5}}}}{a \cdot 2} \]
    10. Step-by-step derivation
      1. clear-num53.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\frac{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}}}\right)}^{-1}} \]
    12. Step-by-step derivation
      1. unpow-153.5%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{a \cdot 2}{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)} \cdot \left(\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)}} \]
    13. Simplified53.5%

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

      \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + \left(\frac{a}{b} + \frac{{a}^{2} \cdot c}{{b}^{3}}\right)}} \]
    15. Step-by-step derivation
      1. associate-+r+91.1%

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

        \[\leadsto \frac{1}{\color{blue}{\left(\frac{a}{b} + -1 \cdot \frac{b}{c}\right)} + \frac{{a}^{2} \cdot c}{{b}^{3}}} \]
      3. mul-1-neg91.1%

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

        \[\leadsto \frac{1}{\color{blue}{\left(\frac{a}{b} - \frac{b}{c}\right)} + \frac{{a}^{2} \cdot c}{{b}^{3}}} \]
      5. associate-/l*91.1%

        \[\leadsto \frac{1}{\left(\frac{a}{b} - \frac{b}{c}\right) + \color{blue}{\frac{{a}^{2}}{\frac{{b}^{3}}{c}}}} \]
    16. Simplified91.1%

      \[\leadsto \frac{1}{\color{blue}{\left(\frac{a}{b} - \frac{b}{c}\right) + \frac{{a}^{2}}{\frac{{b}^{3}}{c}}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.2%

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

Alternative 3: 89.2% 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 -120:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(\frac{a}{b} + \frac{c \cdot {a}^{2}}{{b}^{3}}\right) - \frac{b}{c}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) -120.0)
   (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* a 2.0))
   (/ 1.0 (- (+ (/ a b) (/ (* c (pow a 2.0)) (pow b 3.0))) (/ b c)))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -120.0) {
		tmp = (sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (a * 2.0);
	} else {
		tmp = 1.0 / (((a / b) + ((c * pow(a, 2.0)) / pow(b, 3.0))) - (b / c));
	}
	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)) <= -120.0)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(1.0 / Float64(Float64(Float64(a / b) + Float64(Float64(c * (a ^ 2.0)) / (b ^ 3.0))) - Float64(b / c)));
	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], -120.0], N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(a / b), $MachinePrecision] + N[(N[(c * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b / c), $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 -120:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(\frac{a}{b} + \frac{c \cdot {a}^{2}}{{b}^{3}}\right) - \frac{b}{c}}\\


\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)) < -120

    1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 51.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Applied egg-rr51.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}{\left(-b\right) - {\left(\frac{1}{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)}^{-0.5}}}}{a \cdot 2} \]
    10. Step-by-step derivation
      1. clear-num53.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\frac{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}}}\right)}^{-1}} \]
    12. Step-by-step derivation
      1. unpow-153.5%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{a \cdot 2}{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)} \cdot \left(\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)}} \]
    13. Simplified53.5%

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

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

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

Alternative 4: 85.4% 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.08:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) -0.08)
   (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* a 2.0))
   (/ 1.0 (- (/ a b) (/ b c)))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -0.08) {
		tmp = (sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (a * 2.0);
	} else {
		tmp = 1.0 / ((a / b) - (b / c));
	}
	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.08)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(1.0 / Float64(Float64(a / b) - Float64(b / c)));
	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.08], N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] - N[(b / c), $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.08:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\


\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.0800000000000000017

    1. Initial program 79.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.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. *-commutative46.8%

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Applied egg-rr46.5%

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

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

      \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \frac{1}{\frac{1}{\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)}}}{\left(-b\right) - {\left(\frac{1}{\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)}\right)}^{-0.5}}}}{a \cdot 2} \]
    8. Step-by-step derivation
      1. unpow247.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}{\left(-b\right) - {\left(\frac{1}{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)}^{-0.5}}}}{a \cdot 2} \]
    10. Step-by-step derivation
      1. clear-num48.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\frac{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}}}\right)}^{-1}} \]
    12. Step-by-step derivation
      1. unpow-148.5%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{a \cdot 2}{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)} \cdot \left(\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)}} \]
    13. Simplified48.5%

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

      \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + \frac{a}{b}}} \]
    15. Step-by-step derivation
      1. +-commutative88.8%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} + -1 \cdot \frac{b}{c}}} \]
      2. mul-1-neg88.8%

        \[\leadsto \frac{1}{\frac{a}{b} + \color{blue}{\left(-\frac{b}{c}\right)}} \]
      3. unsub-neg88.8%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} - \frac{b}{c}}} \]
    16. Simplified88.8%

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

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

Alternative 5: 85.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\
\mathbf{if}\;t_0 \leq -0.08:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\


\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.0800000000000000017

    1. Initial program 79.0%

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

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

    1. Initial program 46.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. *-commutative46.8%

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Applied egg-rr46.5%

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

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

      \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \frac{1}{\frac{1}{\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)}}}{\left(-b\right) - {\left(\frac{1}{\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)}\right)}^{-0.5}}}}{a \cdot 2} \]
    8. Step-by-step derivation
      1. unpow247.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}{\left(-b\right) - {\left(\frac{1}{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)}^{-0.5}}}}{a \cdot 2} \]
    10. Step-by-step derivation
      1. clear-num48.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\frac{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}}}\right)}^{-1}} \]
    12. Step-by-step derivation
      1. unpow-148.5%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{a \cdot 2}{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)} \cdot \left(\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)}} \]
    13. Simplified48.5%

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

      \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + \frac{a}{b}}} \]
    15. Step-by-step derivation
      1. +-commutative88.8%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} + -1 \cdot \frac{b}{c}}} \]
      2. mul-1-neg88.8%

        \[\leadsto \frac{1}{\frac{a}{b} + \color{blue}{\left(-\frac{b}{c}\right)}} \]
      3. unsub-neg88.8%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} - \frac{b}{c}}} \]
    16. Simplified88.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -0.08:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 99.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \frac{\frac{4 \cdot \left(c \cdot a\right)}{\left(-b\right) - {\left(\frac{1}{{b}^{2} + c \cdot \left(a \cdot -4\right)}\right)}^{-0.5}}}{a \cdot 2} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/
  (/
   (* 4.0 (* c a))
   (- (- b) (pow (/ 1.0 (+ (pow b 2.0) (* c (* a -4.0)))) -0.5)))
  (* a 2.0)))
double code(double a, double b, double c) {
	return ((4.0 * (c * a)) / (-b - pow((1.0 / (pow(b, 2.0) + (c * (a * -4.0)))), -0.5))) / (a * 2.0);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = ((4.0d0 * (c * a)) / (-b - ((1.0d0 / ((b ** 2.0d0) + (c * (a * (-4.0d0))))) ** (-0.5d0)))) / (a * 2.0d0)
end function
public static double code(double a, double b, double c) {
	return ((4.0 * (c * a)) / (-b - Math.pow((1.0 / (Math.pow(b, 2.0) + (c * (a * -4.0)))), -0.5))) / (a * 2.0);
}
def code(a, b, c):
	return ((4.0 * (c * a)) / (-b - math.pow((1.0 / (math.pow(b, 2.0) + (c * (a * -4.0)))), -0.5))) / (a * 2.0)
function code(a, b, c)
	return Float64(Float64(Float64(4.0 * Float64(c * a)) / Float64(Float64(-b) - (Float64(1.0 / Float64((b ^ 2.0) + Float64(c * Float64(a * -4.0)))) ^ -0.5))) / Float64(a * 2.0))
end
function tmp = code(a, b, c)
	tmp = ((4.0 * (c * a)) / (-b - ((1.0 / ((b ^ 2.0) + (c * (a * -4.0)))) ^ -0.5))) / (a * 2.0);
end
code[a_, b_, c_] := N[(N[(N[(4.0 * N[(c * a), $MachinePrecision]), $MachinePrecision] / N[((-b) - N[Power[N[(1.0 / N[(N[Power[b, 2.0], $MachinePrecision] + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{4 \cdot \left(c \cdot a\right)}{\left(-b\right) - {\left(\frac{1}{{b}^{2} + c \cdot \left(a \cdot -4\right)}\right)}^{-0.5}}}{a \cdot 2}
\end{array}
Derivation
  1. Initial program 54.0%

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Applied egg-rr53.7%

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

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

    \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \frac{1}{\frac{1}{\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)}}}{\left(-b\right) - {\left(\frac{1}{\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)}\right)}^{-0.5}}}}{a \cdot 2} \]
  8. Step-by-step derivation
    1. unpow255.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}{\left(-b\right) - {\left(\frac{1}{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)}^{-0.5}}}}{a \cdot 2} \]
  10. Taylor expanded in b around 0 99.3%

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

      \[\leadsto \frac{\frac{4 \cdot \left(a \cdot c\right)}{\left(-b\right) - {\left(\frac{1}{\color{blue}{c \cdot \left(a \cdot -4\right) + {b}^{2}}}\right)}^{-0.5}}}{a \cdot 2} \]
  12. Applied egg-rr99.3%

    \[\leadsto \frac{\frac{4 \cdot \left(a \cdot c\right)}{\left(-b\right) - {\left(\frac{1}{\color{blue}{c \cdot \left(a \cdot -4\right) + {b}^{2}}}\right)}^{-0.5}}}{a \cdot 2} \]
  13. Final simplification99.3%

    \[\leadsto \frac{\frac{4 \cdot \left(c \cdot a\right)}{\left(-b\right) - {\left(\frac{1}{{b}^{2} + c \cdot \left(a \cdot -4\right)}\right)}^{-0.5}}}{a \cdot 2} \]
  14. Add Preprocessing

Alternative 7: 81.5% accurate, 12.9× speedup?

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

\\
\frac{1}{\frac{a}{b} - \frac{b}{c}}
\end{array}
Derivation
  1. Initial program 54.0%

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Applied egg-rr53.7%

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

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

    \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \frac{1}{\frac{1}{\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)}}}{\left(-b\right) - {\left(\frac{1}{\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)}\right)}^{-0.5}}}}{a \cdot 2} \]
  8. Step-by-step derivation
    1. unpow255.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}{\left(-b\right) - {\left(\frac{1}{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}\right)}^{-0.5}}}}{a \cdot 2} \]
  10. Step-by-step derivation
    1. clear-num55.7%

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\frac{{b}^{2} - \mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, {b}^{2}\right)}}}\right)}^{-1}} \]
  12. Step-by-step derivation
    1. unpow-155.7%

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

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

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

    \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + \frac{a}{b}}} \]
  15. Step-by-step derivation
    1. +-commutative83.1%

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} + -1 \cdot \frac{b}{c}}} \]
    2. mul-1-neg83.1%

      \[\leadsto \frac{1}{\frac{a}{b} + \color{blue}{\left(-\frac{b}{c}\right)}} \]
    3. unsub-neg83.1%

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} - \frac{b}{c}}} \]
  16. Simplified83.1%

    \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} - \frac{b}{c}}} \]
  17. Final simplification83.1%

    \[\leadsto \frac{1}{\frac{a}{b} - \frac{b}{c}} \]
  18. Add Preprocessing

Alternative 8: 63.8% 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.0%

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in b around inf 65.8%

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
  6. Step-by-step derivation
    1. mul-1-neg65.8%

      \[\leadsto \color{blue}{-\frac{c}{b}} \]
    2. distribute-neg-frac65.8%

      \[\leadsto \color{blue}{\frac{-c}{b}} \]
  7. Simplified65.8%

    \[\leadsto \color{blue}{\frac{-c}{b}} \]
  8. Final simplification65.8%

    \[\leadsto \frac{-c}{b} \]
  9. Add Preprocessing

Reproduce

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