Quadratic roots, narrow range

Percentage Accurate: 55.2% → 99.3%
Time: 16.2s
Alternatives: 10
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 10 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: 55.2% 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.5× speedup?

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

\\
\frac{\frac{4 \cdot \left(c \cdot a\right)}{b + \sqrt{\mathsf{fma}\left(b, b, \left(c \cdot a\right) \cdot -4\right)}}}{a \cdot \left(-2\right)}
\end{array}
Derivation
  1. Initial program 55.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. *-commutative55.8%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified55.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. Step-by-step derivation
    1. neg-sub055.8%

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{0 - {b}^{3}}{0 + \left({b}^{2} + 0 \cdot b\right)}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
  7. Step-by-step derivation
    1. sub0-neg55.1%

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{-{b}^{3}}{{b}^{2}}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
  9. Step-by-step derivation
    1. flip-+55.4%

      \[\leadsto \frac{\color{blue}{\frac{\frac{-{b}^{3}}{{b}^{2}} \cdot \frac{-{b}^{3}}{{b}^{2}} - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\frac{-{b}^{3}}{{b}^{2}} - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}{a \cdot 2} \]
  10. Applied egg-rr57.8%

    \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 4 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)}}}}{a \cdot 2} \]
  11. Step-by-step derivation
    1. associate--r-99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 90.2% accurate, 0.3× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \left(\frac{c \cdot a}{{b}^{3}} + \frac{1}{b}\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 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -2.60000000000000009

    1. Initial program 86.3%

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

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

      \[\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. Step-by-step derivation
      1. neg-sub086.3%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{0 - {b}^{3}}{0 + \left({b}^{2} + 0 \cdot b\right)}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    7. Step-by-step derivation
      1. sub0-neg85.3%

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{-{b}^{3}}{{b}^{2}}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    9. Step-by-step derivation
      1. clear-num85.3%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\left(-b\right) + \sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)}}\right)}^{-1}} \]
    11. Step-by-step derivation
      1. unpow-186.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.60000000000000009 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 52.4%

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

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

      \[\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. Step-by-step derivation
      1. neg-sub052.4%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{0 - {b}^{3}}{0 + \left({b}^{2} + 0 \cdot b\right)}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    7. Step-by-step derivation
      1. sub0-neg51.7%

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{-{b}^{3}}{{b}^{2}}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    9. Step-by-step derivation
      1. clear-num51.7%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\left(-b\right) + \sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)}}\right)}^{-1}} \]
    11. Step-by-step derivation
      1. unpow-152.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + a \cdot \left(-2 \cdot \left(a \cdot \left(-1 \cdot \frac{c}{{b}^{3}} + 0.5 \cdot \frac{c}{{b}^{3}}\right)\right) + \frac{1}{b}\right)}} \]
    14. Taylor expanded in c around 0 91.6%

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

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

Alternative 3: 90.2% accurate, 0.3× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \left(\frac{c \cdot a}{{b}^{3}} + \frac{1}{b}\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 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -2.60000000000000009

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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 -2.60000000000000009 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 52.4%

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

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

      \[\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. Step-by-step derivation
      1. neg-sub052.4%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{0 - {b}^{3}}{0 + \left({b}^{2} + 0 \cdot b\right)}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    7. Step-by-step derivation
      1. sub0-neg51.7%

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{-{b}^{3}}{{b}^{2}}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    9. Step-by-step derivation
      1. clear-num51.7%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\left(-b\right) + \sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)}}\right)}^{-1}} \]
    11. Step-by-step derivation
      1. unpow-152.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + a \cdot \left(-2 \cdot \left(a \cdot \left(-1 \cdot \frac{c}{{b}^{3}} + 0.5 \cdot \frac{c}{{b}^{3}}\right)\right) + \frac{1}{b}\right)}} \]
    14. Taylor expanded in c around 0 91.6%

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

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

Alternative 4: 90.2% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \left(\frac{c \cdot a}{{b}^{3}} + \frac{1}{b}\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 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -2.60000000000000009

    1. Initial program 86.3%

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

    if -2.60000000000000009 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 52.4%

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

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

      \[\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. Step-by-step derivation
      1. neg-sub052.4%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{0 - {b}^{3}}{0 + \left({b}^{2} + 0 \cdot b\right)}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    7. Step-by-step derivation
      1. sub0-neg51.7%

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{-{b}^{3}}{{b}^{2}}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    9. Step-by-step derivation
      1. clear-num51.7%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\left(-b\right) + \sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)}}\right)}^{-1}} \]
    11. Step-by-step derivation
      1. unpow-152.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + a \cdot \left(-2 \cdot \left(a \cdot \left(-1 \cdot \frac{c}{{b}^{3}} + 0.5 \cdot \frac{c}{{b}^{3}}\right)\right) + \frac{1}{b}\right)}} \]
    14. Taylor expanded in c around 0 91.6%

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

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

Alternative 5: 86.0% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{c \cdot a}{a}}{\left(-b\right) - \mathsf{fma}\left(-2, \frac{c \cdot a}{b}, 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 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -0.10000000000000001

    1. Initial program 82.6%

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

    if -0.10000000000000001 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 50.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. *-commutative50.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified50.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. Step-by-step derivation
      1. neg-sub050.7%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{0 - {b}^{3}}{0 + \left({b}^{2} + 0 \cdot b\right)}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    7. Step-by-step derivation
      1. sub0-neg50.1%

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{-{b}^{3}}{{b}^{2}}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    9. Step-by-step derivation
      1. flip-+50.3%

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

      \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - 4 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)}}}}{a \cdot 2} \]
    11. Step-by-step derivation
      1. associate--r-99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{0 \cdot \left(\left(-b\right) - b\right) + \left(4 \cdot a\right) \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}}{a \cdot 2} \]
    14. Step-by-step derivation
      1. *-commutative86.6%

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

      \[\leadsto \frac{\frac{0 \cdot \left(\left(-b\right) - b\right) + \left(4 \cdot a\right) \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \frac{c \cdot a}{b}\right)}}}{a \cdot 2} \]
    16. Step-by-step derivation
      1. div-inv86.5%

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

        \[\leadsto \frac{\color{blue}{\left(4 \cdot a\right) \cdot c + 0 \cdot \left(\left(-b\right) - b\right)}}{\left(-b\right) - \left(b + -2 \cdot \frac{c \cdot a}{b}\right)} \cdot \frac{1}{a \cdot 2} \]
      3. associate-*l*86.5%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(4 \cdot c, a, 0\right)}{\left(-b\right) - \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)} \cdot \frac{1}{a \cdot 2}} \]
    18. Step-by-step derivation
      1. *-commutative86.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{4 \cdot \left(a \cdot c\right)}{\color{blue}{2 \cdot a}}}{\left(-b\right) - \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)} \]
      11. times-frac86.7%

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

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

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

        \[\leadsto \frac{2 \cdot \frac{c \cdot a}{a}}{\left(-b\right) - \mathsf{fma}\left(-2, \color{blue}{\frac{c \cdot a}{b}}, b\right)} \]
    19. Simplified86.7%

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

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

Alternative 6: 86.0% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\frac{c \cdot a}{b} - 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 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -0.10000000000000001

    1. Initial program 82.6%

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

    if -0.10000000000000001 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a))

    1. Initial program 50.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. *-commutative50.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified50.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. Step-by-step derivation
      1. neg-sub050.7%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{0 - {b}^{3}}{0 + \left({b}^{2} + 0 \cdot b\right)}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    7. Step-by-step derivation
      1. sub0-neg50.1%

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{-{b}^{3}}{{b}^{2}}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    9. Step-by-step derivation
      1. clear-num50.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\left(-b\right) + \sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)}}\right)}^{-1}} \]
    11. Step-by-step derivation
      1. unpow-150.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 82.4% accurate, 10.5× speedup?

\[\begin{array}{l} \\ \frac{1}{\frac{\frac{c \cdot a}{b} - b}{c}} \end{array} \]
(FPCore (a b c) :precision binary64 (/ 1.0 (/ (- (/ (* c a) b) b) c)))
double code(double a, double b, double c) {
	return 1.0 / ((((c * 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 / ((((c * a) / b) - b) / c)
end function
public static double code(double a, double b, double c) {
	return 1.0 / ((((c * a) / b) - b) / c);
}
def code(a, b, c):
	return 1.0 / ((((c * a) / b) - b) / c)
function code(a, b, c)
	return Float64(1.0 / Float64(Float64(Float64(Float64(c * a) / b) - b) / c))
end
function tmp = code(a, b, c)
	tmp = 1.0 / ((((c * a) / b) - b) / c);
end
code[a_, b_, c_] := N[(1.0 / N[(N[(N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision] - b), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\frac{\frac{c \cdot a}{b} - b}{c}}
\end{array}
Derivation
  1. Initial program 55.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. *-commutative55.8%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified55.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. Step-by-step derivation
    1. neg-sub055.8%

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{0 - {b}^{3}}{0 + \left({b}^{2} + 0 \cdot b\right)}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
  7. Step-by-step derivation
    1. sub0-neg55.1%

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{-{b}^{3}}{{b}^{2}}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
  9. Step-by-step derivation
    1. clear-num55.2%

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

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

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

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

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

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

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

      \[\leadsto {\left(\frac{a \cdot 2}{\left(-b\right) + \sqrt{{b}^{2} - \color{blue}{4 \cdot \left(a \cdot c\right)}}}\right)}^{-1} \]
  10. Applied egg-rr55.8%

    \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\left(-b\right) + \sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)}}\right)}^{-1}} \]
  11. Step-by-step derivation
    1. unpow-155.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{\frac{-1 \cdot b + \frac{a \cdot c}{b}}{c}}} \]
  14. Final simplification82.4%

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

Alternative 8: 82.4% 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 55.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. *-commutative55.8%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified55.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. Step-by-step derivation
    1. neg-sub055.8%

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{0 - {b}^{3}}{0 + \left({b}^{2} + 0 \cdot b\right)}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
  7. Step-by-step derivation
    1. sub0-neg55.1%

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{-{b}^{3}}{{b}^{2}}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
  9. Step-by-step derivation
    1. clear-num55.2%

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

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

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

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

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

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

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

      \[\leadsto {\left(\frac{a \cdot 2}{\left(-b\right) + \sqrt{{b}^{2} - \color{blue}{4 \cdot \left(a \cdot c\right)}}}\right)}^{-1} \]
  10. Applied egg-rr55.8%

    \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\left(-b\right) + \sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)}}\right)}^{-1}} \]
  11. Step-by-step derivation
    1. unpow-155.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + \frac{a}{b}}} \]
  14. Final simplification82.4%

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

Alternative 9: 64.6% 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 55.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. *-commutative55.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\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
  5. Taylor expanded in b around inf 64.4%

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

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

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

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

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

Alternative 10: 3.2% accurate, 38.7× speedup?

\[\begin{array}{l} \\ \frac{0}{a} \end{array} \]
(FPCore (a b c) :precision binary64 (/ 0.0 a))
double code(double a, double b, double c) {
	return 0.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 = 0.0d0 / a
end function
public static double code(double a, double b, double c) {
	return 0.0 / a;
}
def code(a, b, c):
	return 0.0 / a
function code(a, b, c)
	return Float64(0.0 / a)
end
function tmp = code(a, b, c)
	tmp = 0.0 / a;
end
code[a_, b_, c_] := N[(0.0 / a), $MachinePrecision]
\begin{array}{l}

\\
\frac{0}{a}
\end{array}
Derivation
  1. Initial program 55.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. *-commutative55.8%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified55.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. Step-by-step derivation
    1. neg-sub055.8%

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{0 - {b}^{3}}{0 + \left({b}^{2} + 0 \cdot b\right)}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
  7. Step-by-step derivation
    1. sub0-neg55.1%

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{-{b}^{3}}{{b}^{2}}} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
  9. Taylor expanded in a around 0 3.2%

    \[\leadsto \color{blue}{0.5 \cdot \frac{b + -1 \cdot b}{a}} \]
  10. Step-by-step derivation
    1. associate-*r/3.2%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(b + -1 \cdot b\right)}{a}} \]
    2. distribute-rgt1-in3.2%

      \[\leadsto \frac{0.5 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot b\right)}}{a} \]
    3. metadata-eval3.2%

      \[\leadsto \frac{0.5 \cdot \left(\color{blue}{0} \cdot b\right)}{a} \]
    4. mul0-lft3.2%

      \[\leadsto \frac{0.5 \cdot \color{blue}{0}}{a} \]
    5. metadata-eval3.2%

      \[\leadsto \frac{\color{blue}{0}}{a} \]
  11. Simplified3.2%

    \[\leadsto \color{blue}{\frac{0}{a}} \]
  12. Add Preprocessing

Reproduce

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