Quadratic roots, narrow range

Percentage Accurate: 55.7% → 92.1%
Time: 1.2min
Alternatives: 11
Speedup: 29.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 55.7% accurate, 1.0× speedup?

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

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

Alternative 1: 92.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(4 \cdot a\right) \cdot c\\ t_1 := {b}^{2} - t\_0\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - t\_0} - b}{a \cdot 2} \leq -86:\\ \;\;\;\;\frac{\frac{t\_1 - {\left(-b\right)}^{2}}{b + \sqrt{t\_1}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \left(a \cdot \frac{c}{{b}^{7}}\right) - \frac{2}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* (* 4.0 a) c)) (t_1 (- (pow b 2.0) t_0)))
   (if (<= (/ (- (sqrt (- (* b b) t_0)) b) (* a 2.0)) -86.0)
     (/ (/ (- t_1 (pow (- b) 2.0)) (+ b (sqrt t_1))) (* a 2.0))
     (-
      (*
       a
       (*
        (* c c)
        (+
         (* c (* a (- (* -5.0 (* a (/ c (pow b 7.0)))) (/ 2.0 (pow b 5.0)))))
         (/ -1.0 (pow b 3.0)))))
      (/ c b)))))
double code(double a, double b, double c) {
	double t_0 = (4.0 * a) * c;
	double t_1 = pow(b, 2.0) - t_0;
	double tmp;
	if (((sqrt(((b * b) - t_0)) - b) / (a * 2.0)) <= -86.0) {
		tmp = ((t_1 - pow(-b, 2.0)) / (b + sqrt(t_1))) / (a * 2.0);
	} else {
		tmp = (a * ((c * c) * ((c * (a * ((-5.0 * (a * (c / pow(b, 7.0)))) - (2.0 / pow(b, 5.0))))) + (-1.0 / pow(b, 3.0))))) - (c / b);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (4.0d0 * a) * c
    t_1 = (b ** 2.0d0) - t_0
    if (((sqrt(((b * b) - t_0)) - b) / (a * 2.0d0)) <= (-86.0d0)) then
        tmp = ((t_1 - (-b ** 2.0d0)) / (b + sqrt(t_1))) / (a * 2.0d0)
    else
        tmp = (a * ((c * c) * ((c * (a * (((-5.0d0) * (a * (c / (b ** 7.0d0)))) - (2.0d0 / (b ** 5.0d0))))) + ((-1.0d0) / (b ** 3.0d0))))) - (c / b)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = (4.0 * a) * c;
	double t_1 = Math.pow(b, 2.0) - t_0;
	double tmp;
	if (((Math.sqrt(((b * b) - t_0)) - b) / (a * 2.0)) <= -86.0) {
		tmp = ((t_1 - Math.pow(-b, 2.0)) / (b + Math.sqrt(t_1))) / (a * 2.0);
	} else {
		tmp = (a * ((c * c) * ((c * (a * ((-5.0 * (a * (c / Math.pow(b, 7.0)))) - (2.0 / Math.pow(b, 5.0))))) + (-1.0 / Math.pow(b, 3.0))))) - (c / b);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = (4.0 * a) * c
	t_1 = math.pow(b, 2.0) - t_0
	tmp = 0
	if ((math.sqrt(((b * b) - t_0)) - b) / (a * 2.0)) <= -86.0:
		tmp = ((t_1 - math.pow(-b, 2.0)) / (b + math.sqrt(t_1))) / (a * 2.0)
	else:
		tmp = (a * ((c * c) * ((c * (a * ((-5.0 * (a * (c / math.pow(b, 7.0)))) - (2.0 / math.pow(b, 5.0))))) + (-1.0 / math.pow(b, 3.0))))) - (c / b)
	return tmp
function code(a, b, c)
	t_0 = Float64(Float64(4.0 * a) * c)
	t_1 = Float64((b ^ 2.0) - t_0)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - t_0)) - b) / Float64(a * 2.0)) <= -86.0)
		tmp = Float64(Float64(Float64(t_1 - (Float64(-b) ^ 2.0)) / Float64(b + sqrt(t_1))) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(a * Float64(Float64(c * c) * Float64(Float64(c * Float64(a * Float64(Float64(-5.0 * Float64(a * Float64(c / (b ^ 7.0)))) - Float64(2.0 / (b ^ 5.0))))) + Float64(-1.0 / (b ^ 3.0))))) - Float64(c / b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = (4.0 * a) * c;
	t_1 = (b ^ 2.0) - t_0;
	tmp = 0.0;
	if (((sqrt(((b * b) - t_0)) - b) / (a * 2.0)) <= -86.0)
		tmp = ((t_1 - (-b ^ 2.0)) / (b + sqrt(t_1))) / (a * 2.0);
	else
		tmp = (a * ((c * c) * ((c * (a * ((-5.0 * (a * (c / (b ^ 7.0)))) - (2.0 / (b ^ 5.0))))) + (-1.0 / (b ^ 3.0))))) - (c / b);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[b, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -86.0], N[(N[(N[(t$95$1 - N[Power[(-b), 2.0], $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[(c * c), $MachinePrecision] * N[(N[(c * N[(a * N[(N[(-5.0 * N[(a * N[(c / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(2.0 / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -86

    1. Initial program 92.9%

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

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

      \[\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. add-cbrt-cube92.0%

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    7. Step-by-step derivation
      1. unpow1/392.3%

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

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

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

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

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

        \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left(\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c\right)}{\left(-b\right) - \sqrt{\sqrt[3]{{b}^{6}} - \left(4 \cdot a\right) \cdot c}}}{a \cdot 2} \]
      5. pow-pow94.4%

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

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

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

        \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - c \cdot \left(4 \cdot a\right)\right)}{\left(-b\right) - \sqrt{\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c}}}{a \cdot 2} \]
      9. pow-pow94.4%

        \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - c \cdot \left(4 \cdot a\right)\right)}{\left(-b\right) - \sqrt{\color{blue}{{b}^{\left(6 \cdot 0.3333333333333333\right)}} - \left(4 \cdot a\right) \cdot c}}}{a \cdot 2} \]
      10. metadata-eval94.4%

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

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

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

    if -86 < (/.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 49.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto a \cdot \left({c}^{2} \cdot \left(c \cdot \color{blue}{\left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} - 2 \cdot \frac{1}{{b}^{5}}\right)\right)} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
    10. Step-by-step derivation
      1. associate-/l*93.2%

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

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

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

      \[\leadsto a \cdot \left({c}^{2} \cdot \left(c \cdot \color{blue}{\left(a \cdot \left(-5 \cdot \left(a \cdot \frac{c}{{b}^{7}}\right) - \frac{2}{{b}^{5}}\right)\right)} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
    12. Step-by-step derivation
      1. unpow293.2%

        \[\leadsto a \cdot \left(\color{blue}{\left(c \cdot c\right)} \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \left(a \cdot \frac{c}{{b}^{7}}\right) - \frac{2}{{b}^{5}}\right)\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
    13. Applied egg-rr93.2%

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

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

Alternative 2: 92.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -86:\\ \;\;\;\;0.5 \cdot \frac{\sqrt{{b}^{2} + a \cdot \left(c \cdot -4\right)}}{a} - 0.5 \cdot \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(c \cdot c\right) \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \left(a \cdot \frac{c}{{b}^{7}}\right) - \frac{2}{{b}^{5}}\right)\right) + \frac{-1}{{b}^{3}}\right)\right) - \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* (* 4.0 a) c))) b) (* a 2.0)) -86.0)
   (- (* 0.5 (/ (sqrt (+ (pow b 2.0) (* a (* c -4.0)))) a)) (* 0.5 (/ b a)))
   (-
    (*
     a
     (*
      (* c c)
      (+
       (* c (* a (- (* -5.0 (* a (/ c (pow b 7.0)))) (/ 2.0 (pow b 5.0)))))
       (/ -1.0 (pow b 3.0)))))
    (/ c b))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - ((4.0 * a) * c))) - b) / (a * 2.0)) <= -86.0) {
		tmp = (0.5 * (sqrt((pow(b, 2.0) + (a * (c * -4.0)))) / a)) - (0.5 * (b / a));
	} else {
		tmp = (a * ((c * c) * ((c * (a * ((-5.0 * (a * (c / pow(b, 7.0)))) - (2.0 / pow(b, 5.0))))) + (-1.0 / pow(b, 3.0))))) - (c / b);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (((sqrt(((b * b) - ((4.0d0 * a) * c))) - b) / (a * 2.0d0)) <= (-86.0d0)) then
        tmp = (0.5d0 * (sqrt(((b ** 2.0d0) + (a * (c * (-4.0d0))))) / a)) - (0.5d0 * (b / a))
    else
        tmp = (a * ((c * c) * ((c * (a * (((-5.0d0) * (a * (c / (b ** 7.0d0)))) - (2.0d0 / (b ** 5.0d0))))) + ((-1.0d0) / (b ** 3.0d0))))) - (c / b)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (((Math.sqrt(((b * b) - ((4.0 * a) * c))) - b) / (a * 2.0)) <= -86.0) {
		tmp = (0.5 * (Math.sqrt((Math.pow(b, 2.0) + (a * (c * -4.0)))) / a)) - (0.5 * (b / a));
	} else {
		tmp = (a * ((c * c) * ((c * (a * ((-5.0 * (a * (c / Math.pow(b, 7.0)))) - (2.0 / Math.pow(b, 5.0))))) + (-1.0 / Math.pow(b, 3.0))))) - (c / b);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if ((math.sqrt(((b * b) - ((4.0 * a) * c))) - b) / (a * 2.0)) <= -86.0:
		tmp = (0.5 * (math.sqrt((math.pow(b, 2.0) + (a * (c * -4.0)))) / a)) - (0.5 * (b / a))
	else:
		tmp = (a * ((c * c) * ((c * (a * ((-5.0 * (a * (c / math.pow(b, 7.0)))) - (2.0 / math.pow(b, 5.0))))) + (-1.0 / math.pow(b, 3.0))))) - (c / b)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c))) - b) / Float64(a * 2.0)) <= -86.0)
		tmp = Float64(Float64(0.5 * Float64(sqrt(Float64((b ^ 2.0) + Float64(a * Float64(c * -4.0)))) / a)) - Float64(0.5 * Float64(b / a)));
	else
		tmp = Float64(Float64(a * Float64(Float64(c * c) * Float64(Float64(c * Float64(a * Float64(Float64(-5.0 * Float64(a * Float64(c / (b ^ 7.0)))) - Float64(2.0 / (b ^ 5.0))))) + Float64(-1.0 / (b ^ 3.0))))) - Float64(c / b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (((sqrt(((b * b) - ((4.0 * a) * c))) - b) / (a * 2.0)) <= -86.0)
		tmp = (0.5 * (sqrt(((b ^ 2.0) + (a * (c * -4.0)))) / a)) - (0.5 * (b / a));
	else
		tmp = (a * ((c * c) * ((c * (a * ((-5.0 * (a * (c / (b ^ 7.0)))) - (2.0 / (b ^ 5.0))))) + (-1.0 / (b ^ 3.0))))) - (c / b);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -86.0], N[(N[(0.5 * N[(N[Sqrt[N[(N[Power[b, 2.0], $MachinePrecision] + N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] - N[(0.5 * N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[(c * c), $MachinePrecision] * N[(N[(c * N[(a * N[(N[(-5.0 * N[(a * N[(c / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(2.0 / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -86:\\
\;\;\;\;0.5 \cdot \frac{\sqrt{{b}^{2} + a \cdot \left(c \cdot -4\right)}}{a} - 0.5 \cdot \frac{b}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -86

    1. Initial program 92.9%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\left(-\color{blue}{a \cdot \left(4 \cdot c\right)}\right) + b \cdot b} - b}{2 \cdot a} \]
      9. distribute-rgt-neg-in92.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -86 < (/.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 49.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto a \cdot \left({c}^{2} \cdot \left(c \cdot \color{blue}{\left(a \cdot \left(-5 \cdot \frac{a \cdot c}{{b}^{7}} - 2 \cdot \frac{1}{{b}^{5}}\right)\right)} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
    10. Step-by-step derivation
      1. associate-/l*93.2%

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

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

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

      \[\leadsto a \cdot \left({c}^{2} \cdot \left(c \cdot \color{blue}{\left(a \cdot \left(-5 \cdot \left(a \cdot \frac{c}{{b}^{7}}\right) - \frac{2}{{b}^{5}}\right)\right)} - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
    12. Step-by-step derivation
      1. unpow293.2%

        \[\leadsto a \cdot \left(\color{blue}{\left(c \cdot c\right)} \cdot \left(c \cdot \left(a \cdot \left(-5 \cdot \left(a \cdot \frac{c}{{b}^{7}}\right) - \frac{2}{{b}^{5}}\right)\right) - \frac{1}{{b}^{3}}\right)\right) - \frac{c}{b} \]
    13. Applied egg-rr93.2%

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

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

Alternative 3: 89.7% accurate, 0.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -1.1499999999999999

    1. Initial program 84.6%

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

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

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

        \[\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-neg84.6%

        \[\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-neg84.6%

        \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b} - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \]
      6. fma-neg84.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-in84.8%

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{c \cdot \left(-4 \cdot a\right)}\right)} - b}{a \cdot 2} \]
      9. *-commutative84.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-in84.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-eval84.8%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \color{blue}{-4}\right)\right)} - b}{a \cdot 2} \]
    3. Simplified84.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

    if -1.1499999999999999 < (/.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 46.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. *-commutative46.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified46.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. Taylor expanded in a around 0 94.4%

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

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

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

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

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

      \[\leadsto a \cdot \color{blue}{\left({c}^{2} \cdot \left(-2 \cdot \frac{a \cdot c}{{b}^{5}} - \frac{1}{{b}^{3}}\right)\right)} - \frac{c}{b} \]
    9. Step-by-step derivation
      1. associate-*r/92.8%

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

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

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

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

Alternative 4: 89.7% accurate, 0.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -1.1499999999999999

    1. Initial program 84.6%

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

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

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

        \[\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-neg84.6%

        \[\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-neg84.6%

        \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b} - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \]
      6. fma-neg84.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-in84.8%

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{c \cdot \left(-4 \cdot a\right)}\right)} - b}{a \cdot 2} \]
      9. *-commutative84.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-in84.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-eval84.8%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \color{blue}{-4}\right)\right)} - b}{a \cdot 2} \]
    3. Simplified84.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

    if -1.1499999999999999 < (/.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 46.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. *-commutative46.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified46.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. Taylor expanded in b around inf 92.8%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(-2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} - c\right)} - \frac{a \cdot {c}^{2}}{{b}^{2}}}{b} \]
      6. associate-/l*92.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 85.6% accurate, 0.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{b - a \cdot \frac{c}{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)) < -1.1499999999999999

    1. Initial program 84.6%

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

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

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

        \[\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-neg84.6%

        \[\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-neg84.6%

        \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b} - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \]
      6. fma-neg84.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-in84.8%

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{c \cdot \left(-4 \cdot a\right)}\right)} - b}{a \cdot 2} \]
      9. *-commutative84.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-in84.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-eval84.8%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \color{blue}{-4}\right)\right)} - b}{a \cdot 2} \]
    3. Simplified84.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

    if -1.1499999999999999 < (/.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 46.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. *-commutative46.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified46.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. Taylor expanded in b around inf 88.8%

      \[\leadsto \color{blue}{\frac{-1 \cdot c + -1 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg88.8%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-c\right) - \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
    8. Step-by-step derivation
      1. clear-num88.6%

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

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

        \[\leadsto {\left(\frac{b}{\left(-c\right) - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{2}}}}\right)}^{-1} \]
    9. Applied egg-rr88.6%

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

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

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

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

        \[\leadsto \frac{1}{\frac{b}{-\color{blue}{\left(a \cdot \frac{{c}^{2}}{{b}^{2}} + c\right)}}} \]
      5. remove-double-neg88.6%

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

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

        \[\leadsto \frac{1}{\frac{b}{-\color{blue}{\mathsf{fma}\left(a, \frac{{c}^{2}}{{b}^{2}}, -\left(-c\right)\right)}}} \]
      8. unpow288.6%

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

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

        \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, \color{blue}{\frac{c}{b} \cdot \frac{c}{b}}, -\left(-c\right)\right)}} \]
      11. unpow288.6%

        \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, \color{blue}{{\left(\frac{c}{b}\right)}^{2}}, -\left(-c\right)\right)}} \]
      12. remove-double-neg88.6%

        \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, \color{blue}{c}\right)}} \]
    11. Simplified88.6%

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

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

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

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

        \[\leadsto \frac{1}{\frac{\color{blue}{\frac{a \cdot c}{b} - b}}{c}} \]
      4. associate-/l*89.0%

        \[\leadsto \frac{1}{\frac{\color{blue}{a \cdot \frac{c}{b}} - b}{c}} \]
    14. Simplified89.0%

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

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

Alternative 6: 85.5% accurate, 0.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{b - a \cdot \frac{c}{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)) < -1.1499999999999999

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.1499999999999999 < (/.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 46.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. *-commutative46.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified46.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. Taylor expanded in b around inf 88.8%

      \[\leadsto \color{blue}{\frac{-1 \cdot c + -1 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg88.8%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-c\right) - \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
    8. Step-by-step derivation
      1. clear-num88.6%

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

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

        \[\leadsto {\left(\frac{b}{\left(-c\right) - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{2}}}}\right)}^{-1} \]
    9. Applied egg-rr88.6%

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

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

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

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

        \[\leadsto \frac{1}{\frac{b}{-\color{blue}{\left(a \cdot \frac{{c}^{2}}{{b}^{2}} + c\right)}}} \]
      5. remove-double-neg88.6%

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

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

        \[\leadsto \frac{1}{\frac{b}{-\color{blue}{\mathsf{fma}\left(a, \frac{{c}^{2}}{{b}^{2}}, -\left(-c\right)\right)}}} \]
      8. unpow288.6%

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

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

        \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, \color{blue}{\frac{c}{b} \cdot \frac{c}{b}}, -\left(-c\right)\right)}} \]
      11. unpow288.6%

        \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, \color{blue}{{\left(\frac{c}{b}\right)}^{2}}, -\left(-c\right)\right)}} \]
      12. remove-double-neg88.6%

        \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, \color{blue}{c}\right)}} \]
    11. Simplified88.6%

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

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

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

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

        \[\leadsto \frac{1}{\frac{\color{blue}{\frac{a \cdot c}{b} - b}}{c}} \]
      4. associate-/l*89.0%

        \[\leadsto \frac{1}{\frac{\color{blue}{a \cdot \frac{c}{b}} - b}{c}} \]
    14. Simplified89.0%

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

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

Alternative 7: 85.5% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{b - a \cdot \frac{c}{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)) < -1.1499999999999999

    1. Initial program 84.6%

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

    if -1.1499999999999999 < (/.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 46.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. *-commutative46.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified46.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. Taylor expanded in b around inf 88.8%

      \[\leadsto \color{blue}{\frac{-1 \cdot c + -1 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg88.8%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-c\right) - \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
    8. Step-by-step derivation
      1. clear-num88.6%

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

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

        \[\leadsto {\left(\frac{b}{\left(-c\right) - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{2}}}}\right)}^{-1} \]
    9. Applied egg-rr88.6%

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

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

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

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

        \[\leadsto \frac{1}{\frac{b}{-\color{blue}{\left(a \cdot \frac{{c}^{2}}{{b}^{2}} + c\right)}}} \]
      5. remove-double-neg88.6%

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

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

        \[\leadsto \frac{1}{\frac{b}{-\color{blue}{\mathsf{fma}\left(a, \frac{{c}^{2}}{{b}^{2}}, -\left(-c\right)\right)}}} \]
      8. unpow288.6%

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

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

        \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, \color{blue}{\frac{c}{b} \cdot \frac{c}{b}}, -\left(-c\right)\right)}} \]
      11. unpow288.6%

        \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, \color{blue}{{\left(\frac{c}{b}\right)}^{2}}, -\left(-c\right)\right)}} \]
      12. remove-double-neg88.6%

        \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, \color{blue}{c}\right)}} \]
    11. Simplified88.6%

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

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

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

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

        \[\leadsto \frac{1}{\frac{\color{blue}{\frac{a \cdot c}{b} - b}}{c}} \]
      4. associate-/l*89.0%

        \[\leadsto \frac{1}{\frac{\color{blue}{a \cdot \frac{c}{b}} - b}{c}} \]
    14. Simplified89.0%

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

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

Alternative 8: 82.1% accurate, 10.5× speedup?

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{-1 \cdot c + -1 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
  6. Step-by-step derivation
    1. mul-1-neg83.9%

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

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

      \[\leadsto \frac{\color{blue}{\left(-c\right)} - \frac{a \cdot {c}^{2}}{{b}^{2}}}{b} \]
  7. Simplified83.9%

    \[\leadsto \color{blue}{\frac{\left(-c\right) - \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
  8. Step-by-step derivation
    1. clear-num83.6%

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

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

      \[\leadsto {\left(\frac{b}{\left(-c\right) - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{2}}}}\right)}^{-1} \]
  9. Applied egg-rr83.6%

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

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

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

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

      \[\leadsto \frac{1}{\frac{b}{-\color{blue}{\left(a \cdot \frac{{c}^{2}}{{b}^{2}} + c\right)}}} \]
    5. remove-double-neg83.6%

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

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

      \[\leadsto \frac{1}{\frac{b}{-\color{blue}{\mathsf{fma}\left(a, \frac{{c}^{2}}{{b}^{2}}, -\left(-c\right)\right)}}} \]
    8. unpow283.6%

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

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

      \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, \color{blue}{\frac{c}{b} \cdot \frac{c}{b}}, -\left(-c\right)\right)}} \]
    11. unpow283.6%

      \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, \color{blue}{{\left(\frac{c}{b}\right)}^{2}}, -\left(-c\right)\right)}} \]
    12. remove-double-neg83.6%

      \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, \color{blue}{c}\right)}} \]
  11. Simplified83.6%

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

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

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

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

      \[\leadsto \frac{1}{\frac{\color{blue}{\frac{a \cdot c}{b} - b}}{c}} \]
    4. associate-/l*84.2%

      \[\leadsto \frac{1}{\frac{\color{blue}{a \cdot \frac{c}{b}} - b}{c}} \]
  14. Simplified84.2%

    \[\leadsto \frac{1}{\color{blue}{\frac{a \cdot \frac{c}{b} - b}{c}}} \]
  15. Final simplification84.2%

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

Alternative 9: 82.1% accurate, 12.9× speedup?

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{-1 \cdot c + -1 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
  6. Step-by-step derivation
    1. mul-1-neg83.9%

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

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

      \[\leadsto \frac{\color{blue}{\left(-c\right)} - \frac{a \cdot {c}^{2}}{{b}^{2}}}{b} \]
  7. Simplified83.9%

    \[\leadsto \color{blue}{\frac{\left(-c\right) - \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
  8. Step-by-step derivation
    1. clear-num83.6%

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

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

      \[\leadsto {\left(\frac{b}{\left(-c\right) - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{2}}}}\right)}^{-1} \]
  9. Applied egg-rr83.6%

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

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

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

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

      \[\leadsto \frac{1}{\frac{b}{-\color{blue}{\left(a \cdot \frac{{c}^{2}}{{b}^{2}} + c\right)}}} \]
    5. remove-double-neg83.6%

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

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

      \[\leadsto \frac{1}{\frac{b}{-\color{blue}{\mathsf{fma}\left(a, \frac{{c}^{2}}{{b}^{2}}, -\left(-c\right)\right)}}} \]
    8. unpow283.6%

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

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

      \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, \color{blue}{\frac{c}{b} \cdot \frac{c}{b}}, -\left(-c\right)\right)}} \]
    11. unpow283.6%

      \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, \color{blue}{{\left(\frac{c}{b}\right)}^{2}}, -\left(-c\right)\right)}} \]
    12. remove-double-neg83.6%

      \[\leadsto \frac{1}{\frac{b}{-\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, \color{blue}{c}\right)}} \]
  11. Simplified83.6%

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} - \frac{b}{c}}} \]
  14. Simplified84.2%

    \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} - \frac{b}{c}}} \]
  15. Final simplification84.2%

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

Alternative 10: 64.2% 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(c / Float64(-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 51.9%

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

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

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

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

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

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

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

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

Alternative 11: 3.2% accurate, 116.0× speedup?

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

\\
0
\end{array}
Derivation
  1. Initial program 51.9%

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

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

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

    \[\leadsto \color{blue}{\frac{-1 \cdot c + -1 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
  6. Step-by-step derivation
    1. mul-1-neg83.9%

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

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

      \[\leadsto \frac{\color{blue}{\left(-c\right)} - \frac{a \cdot {c}^{2}}{{b}^{2}}}{b} \]
  7. Simplified83.9%

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

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(-c\right) - \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}\right)\right)} \]
    2. expm1-undefine53.9%

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

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\left(-c\right) - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{2}}}}{b}\right)} - 1 \]
  9. Applied egg-rr53.9%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\left(-c\right) - a \cdot \frac{{c}^{2}}{{b}^{2}}}{b}\right)} - 1} \]
  10. Step-by-step derivation
    1. sub-neg53.9%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\left(-c\right) - a \cdot \frac{{c}^{2}}{{b}^{2}}}{b}\right)} + \left(-1\right)} \]
  11. Simplified62.5%

    \[\leadsto \color{blue}{\left(1 - \frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right)}{b}\right) + -1} \]
  12. Taylor expanded in c around 0 3.2%

    \[\leadsto \color{blue}{1} + -1 \]
  13. Step-by-step derivation
    1. metadata-eval3.2%

      \[\leadsto \color{blue}{0} \]
  14. Applied egg-rr3.2%

    \[\leadsto \color{blue}{0} \]
  15. Add Preprocessing

Reproduce

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