Quadratic roots, narrow range

Percentage Accurate: 56.0% → 91.5%
Time: 16.7s
Alternatives: 15
Speedup: 23.2×

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 15 alternatives:

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

Initial Program: 56.0% accurate, 1.0× speedup?

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

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

Alternative 1: 91.5% accurate, 0.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{t\_3 \cdot t\_3} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot t\_3}\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.80000000000000004

    1. Initial program 85.3%

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

      \[\leadsto \frac{\color{blue}{\frac{b \cdot b + c \cdot \left(a \cdot -4\right)}{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}} - \frac{b \cdot b}{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}}}{2 \cdot a} \]
    4. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{\frac{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{b \cdot b + c \cdot \left(a \cdot -4\right)}} - \frac{b \cdot b}{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}\right), \mathsf{*.f64}\left(2, a\right)\right) \]
      2. frac-subN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1 \cdot \left(b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\right) - \frac{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{b \cdot b + c \cdot \left(a \cdot -4\right)} \cdot \left(b \cdot b\right)}{\frac{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{b \cdot b + c \cdot \left(a \cdot -4\right)} \cdot \left(b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\right)}\right), \mathsf{*.f64}\left(\color{blue}{2}, a\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 \cdot \left(b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\right) - \frac{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{b \cdot b + c \cdot \left(a \cdot -4\right)} \cdot \left(b \cdot b\right)\right), \left(\frac{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{b \cdot b + c \cdot \left(a \cdot -4\right)} \cdot \left(b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{2}, a\right)\right) \]
    5. Applied egg-rr87.0%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\left(\left(c \cdot \left(c \cdot c\right)\right) \cdot -2\right) \cdot \left(a \cdot a\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + \left(\left(\left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{20}{a}\right) \cdot \frac{-0.25}{{b}^{6}} - \left(c + a \cdot \left(c \cdot \frac{\frac{c}{b}}{b}\right)\right)\right)}{b}} \]
    5. Applied egg-rr94.5%

      \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot c\right) \cdot \left(c \cdot \left(-2 \cdot \left(a \cdot a\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)} + \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) \cdot \left(\left(c \cdot \left(c \cdot \left(c \cdot c\right)\right)\right) \cdot \frac{-5}{a \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)}\right)\right) - \frac{c \cdot a}{\frac{b}{\frac{c}{b}}}\right) - c}}{b} \]
    6. Applied egg-rr94.5%

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

      \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}\right) - c}}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.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.8:\\ \;\;\;\;\frac{\frac{\left(b + \sqrt{b \cdot b + \left(a \cdot c\right) \cdot -4}\right) - \left(b \cdot b\right) \cdot \frac{b + \sqrt{b \cdot b + \left(a \cdot c\right) \cdot -4}}{b \cdot b + \left(a \cdot c\right) \cdot -4}}{\left(b + \sqrt{b \cdot b + \left(a \cdot c\right) \cdot -4}\right) \cdot \frac{b + \sqrt{b \cdot b + \left(a \cdot c\right) \cdot -4}}{b \cdot b + \left(a \cdot c\right) \cdot -4}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}\right) - c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 91.6% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{t\_1 \cdot t\_1} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot t\_1}\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.80000000000000004

    1. Initial program 85.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)}{\color{blue}{2} \cdot a} \]
      2. unsub-negN/A

        \[\leadsto \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{\color{blue}{2} \cdot a} \]
      3. div-subN/A

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{a \cdot 2} - \frac{b}{a \cdot 2}} \]
    5. Step-by-step derivation
      1. sub-divN/A

        \[\leadsto \frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} - b}{\color{blue}{a \cdot 2}} \]
      2. div-invN/A

        \[\leadsto \left(\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} - b\right) \cdot \color{blue}{\frac{1}{a \cdot 2}} \]
      3. flip--N/A

        \[\leadsto \frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} \cdot \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} - b \cdot b}{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} + b} \cdot \frac{\color{blue}{1}}{a \cdot 2} \]
      4. rem-square-sqrtN/A

        \[\leadsto \frac{\left(b \cdot b + c \cdot \left(a \cdot -4\right)\right) - b \cdot b}{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} + b} \cdot \frac{1}{a \cdot 2} \]
      5. +-commutativeN/A

        \[\leadsto \frac{\left(b \cdot b + c \cdot \left(a \cdot -4\right)\right) - b \cdot b}{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}} \cdot \frac{1}{a \cdot 2} \]
      6. associate-*l/N/A

        \[\leadsto \frac{\left(\left(b \cdot b + c \cdot \left(a \cdot -4\right)\right) - b \cdot b\right) \cdot \frac{1}{a \cdot 2}}{\color{blue}{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}} \]
      7. /-lowering-/.f64N/A

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\left(\left(c \cdot \left(c \cdot c\right)\right) \cdot -2\right) \cdot \left(a \cdot a\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + \left(\left(\left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{20}{a}\right) \cdot \frac{-0.25}{{b}^{6}} - \left(c + a \cdot \left(c \cdot \frac{\frac{c}{b}}{b}\right)\right)\right)}{b}} \]
    5. Applied egg-rr94.5%

      \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot c\right) \cdot \left(c \cdot \left(-2 \cdot \left(a \cdot a\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)} + \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) \cdot \left(\left(c \cdot \left(c \cdot \left(c \cdot c\right)\right)\right) \cdot \frac{-5}{a \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)}\right)\right) - \frac{c \cdot a}{\frac{b}{\frac{c}{b}}}\right) - c}}{b} \]
    6. Applied egg-rr94.5%

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

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

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

Alternative 3: 91.6% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{t\_1 \cdot t\_1} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot t\_1}\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.80000000000000004

    1. Initial program 85.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)}{\color{blue}{2} \cdot a} \]
      2. unsub-negN/A

        \[\leadsto \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{\color{blue}{2} \cdot a} \]
      3. div-subN/A

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{a \cdot 2} - \frac{b}{a \cdot 2}} \]
    5. Step-by-step derivation
      1. div-invN/A

        \[\leadsto \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} \cdot \frac{1}{a \cdot 2} - \frac{\color{blue}{b}}{a \cdot 2} \]
      2. div-invN/A

        \[\leadsto \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} \cdot \frac{1}{a \cdot 2} - b \cdot \color{blue}{\frac{1}{a \cdot 2}} \]
      3. distribute-rgt-out--N/A

        \[\leadsto \frac{1}{a \cdot 2} \cdot \color{blue}{\left(\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} - b\right)} \]
      4. flip--N/A

        \[\leadsto \frac{1}{a \cdot 2} \cdot \frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} \cdot \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} - b \cdot b}{\color{blue}{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} + b}} \]
      5. rem-square-sqrtN/A

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

        \[\leadsto \frac{1}{a \cdot 2} \cdot \frac{\left(b \cdot b + c \cdot \left(a \cdot -4\right)\right) - b \cdot b}{b + \color{blue}{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}} \]
      7. sub-divN/A

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

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

      \[\leadsto \color{blue}{\frac{0.5}{a} \cdot \left(\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} - b\right)} \]
    7. Step-by-step derivation
      1. flip--N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \left(\frac{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} \cdot \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} - b \cdot b}{\color{blue}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} + b}}\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), \mathsf{/.f64}\left(\left(\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} \cdot \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} - b \cdot b\right), \color{blue}{\left(\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} + b\right)}\right)\right) \]
    8. Applied egg-rr86.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\left(\left(c \cdot \left(c \cdot c\right)\right) \cdot -2\right) \cdot \left(a \cdot a\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + \left(\left(\left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{20}{a}\right) \cdot \frac{-0.25}{{b}^{6}} - \left(c + a \cdot \left(c \cdot \frac{\frac{c}{b}}{b}\right)\right)\right)}{b}} \]
    5. Applied egg-rr94.5%

      \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot c\right) \cdot \left(c \cdot \left(-2 \cdot \left(a \cdot a\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)} + \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) \cdot \left(\left(c \cdot \left(c \cdot \left(c \cdot c\right)\right)\right) \cdot \frac{-5}{a \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)}\right)\right) - \frac{c \cdot a}{\frac{b}{\frac{c}{b}}}\right) - c}}{b} \]
    6. Applied egg-rr94.5%

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

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

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

Alternative 4: 91.4% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{t\_0 \cdot t\_0} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot t\_0}\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.80000000000000004

    1. Initial program 85.3%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{neg.f64}\left(b\right), \mathsf{sqrt.f64}\left(\color{blue}{\left(c \cdot \left(\frac{{b}^{2}}{c} - 4 \cdot a\right)\right)}\right)\right), \mathsf{*.f64}\left(2, a\right)\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{neg.f64}\left(b\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \left(\frac{{b}^{2}}{c} - 4 \cdot a\right)\right)\right)\right), \mathsf{*.f64}\left(2, a\right)\right) \]
      2. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{neg.f64}\left(b\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \left(\frac{{b}^{2}}{c} + \left(\mathsf{neg}\left(4\right)\right) \cdot a\right)\right)\right)\right), \mathsf{*.f64}\left(2, a\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{neg.f64}\left(b\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \left(\frac{{b}^{2}}{c} + -4 \cdot a\right)\right)\right)\right), \mathsf{*.f64}\left(2, a\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{neg.f64}\left(b\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\left(\frac{{b}^{2}}{c}\right), \left(-4 \cdot a\right)\right)\right)\right)\right), \mathsf{*.f64}\left(2, a\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{neg.f64}\left(b\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left({b}^{2}\right), c\right), \left(-4 \cdot a\right)\right)\right)\right)\right), \mathsf{*.f64}\left(2, a\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{neg.f64}\left(b\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(b \cdot b\right), c\right), \left(-4 \cdot a\right)\right)\right)\right)\right), \mathsf{*.f64}\left(2, a\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{neg.f64}\left(b\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(b, b\right), c\right), \left(-4 \cdot a\right)\right)\right)\right)\right), \mathsf{*.f64}\left(2, a\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{neg.f64}\left(b\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(b, b\right), c\right), \left(a \cdot -4\right)\right)\right)\right)\right), \mathsf{*.f64}\left(2, a\right)\right) \]
      9. *-lowering-*.f6485.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{neg.f64}\left(b\right), \mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(b, b\right), c\right), \mathsf{*.f64}\left(a, -4\right)\right)\right)\right)\right), \mathsf{*.f64}\left(2, a\right)\right) \]
    5. Simplified85.5%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\left(\left(c \cdot \left(c \cdot c\right)\right) \cdot -2\right) \cdot \left(a \cdot a\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + \left(\left(\left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{20}{a}\right) \cdot \frac{-0.25}{{b}^{6}} - \left(c + a \cdot \left(c \cdot \frac{\frac{c}{b}}{b}\right)\right)\right)}{b}} \]
    5. Applied egg-rr94.5%

      \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot c\right) \cdot \left(c \cdot \left(-2 \cdot \left(a \cdot a\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)} + \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) \cdot \left(\left(c \cdot \left(c \cdot \left(c \cdot c\right)\right)\right) \cdot \frac{-5}{a \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)}\right)\right) - \frac{c \cdot a}{\frac{b}{\frac{c}{b}}}\right) - c}}{b} \]
    6. Applied egg-rr94.5%

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

      \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}\right) - c}}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.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.8:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4 + \frac{b \cdot b}{c}\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}\right) - c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 91.4% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{t\_0 \cdot t\_0} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot t\_0}\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.80000000000000004

    1. Initial program 85.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)}{\color{blue}{2} \cdot a} \]
      2. unsub-negN/A

        \[\leadsto \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{\color{blue}{2} \cdot a} \]
      3. div-subN/A

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{a \cdot 2} - \frac{b}{a \cdot 2}} \]
    5. Step-by-step derivation
      1. sub-divN/A

        \[\leadsto \frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} - b}{\color{blue}{a \cdot 2}} \]
      2. flip--N/A

        \[\leadsto \frac{\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} \cdot \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} - b \cdot b}{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} + b}}{\color{blue}{a} \cdot 2} \]
      3. rem-square-sqrtN/A

        \[\leadsto \frac{\frac{\left(b \cdot b + c \cdot \left(a \cdot -4\right)\right) - b \cdot b}{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} + b}}{a \cdot 2} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\frac{\left(b \cdot b + c \cdot \left(a \cdot -4\right)\right) - b \cdot b}{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}}{a \cdot 2} \]
      5. sub-divN/A

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\left(\left(c \cdot \left(c \cdot c\right)\right) \cdot -2\right) \cdot \left(a \cdot a\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + \left(\left(\left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{20}{a}\right) \cdot \frac{-0.25}{{b}^{6}} - \left(c + a \cdot \left(c \cdot \frac{\frac{c}{b}}{b}\right)\right)\right)}{b}} \]
    5. Applied egg-rr94.5%

      \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot c\right) \cdot \left(c \cdot \left(-2 \cdot \left(a \cdot a\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)} + \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) \cdot \left(\left(c \cdot \left(c \cdot \left(c \cdot c\right)\right)\right) \cdot \frac{-5}{a \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)}\right)\right) - \frac{c \cdot a}{\frac{b}{\frac{c}{b}}}\right) - c}}{b} \]
    6. Applied egg-rr94.5%

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

      \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}\right) - c}}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.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.8:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(a \cdot c\right) \cdot -4} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}\right) - c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 91.4% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{t\_0 \cdot t\_0} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot t\_0}\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.80000000000000004

    1. Initial program 85.3%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\left(\left(c \cdot \left(c \cdot c\right)\right) \cdot -2\right) \cdot \left(a \cdot a\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + \left(\left(\left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{20}{a}\right) \cdot \frac{-0.25}{{b}^{6}} - \left(c + a \cdot \left(c \cdot \frac{\frac{c}{b}}{b}\right)\right)\right)}{b}} \]
    5. Applied egg-rr94.5%

      \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot c\right) \cdot \left(c \cdot \left(-2 \cdot \left(a \cdot a\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)} + \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) \cdot \left(\left(c \cdot \left(c \cdot \left(c \cdot c\right)\right)\right) \cdot \frac{-5}{a \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)}\right)\right) - \frac{c \cdot a}{\frac{b}{\frac{c}{b}}}\right) - c}}{b} \]
    6. Applied egg-rr94.5%

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

      \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}\right) - c}}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.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.8:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}\right) - c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 90.6% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := b \cdot \left(b \cdot b\right)\\ \frac{\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{t\_0 \cdot t\_0} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \left(\frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot t\_0} - c\right)}{b} \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* b (* b b))))
   (/
    (+
     (-
      (/ (* (* c (* c (* (* c c) -5.0))) (* a (* a a))) (* t_0 t_0))
      (* c (/ (* a (/ c b)) b)))
     (- (/ (* (* c (* c c)) (* a (* a -2.0))) (* b t_0)) c))
    b)))
double code(double a, double b, double c) {
	double t_0 = b * (b * b);
	return (((((c * (c * ((c * c) * -5.0))) * (a * (a * a))) / (t_0 * t_0)) - (c * ((a * (c / b)) / b))) + ((((c * (c * c)) * (a * (a * -2.0))) / (b * t_0)) - c)) / b;
}
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
    t_0 = b * (b * b)
    code = (((((c * (c * ((c * c) * (-5.0d0)))) * (a * (a * a))) / (t_0 * t_0)) - (c * ((a * (c / b)) / b))) + ((((c * (c * c)) * (a * (a * (-2.0d0)))) / (b * t_0)) - c)) / b
end function
public static double code(double a, double b, double c) {
	double t_0 = b * (b * b);
	return (((((c * (c * ((c * c) * -5.0))) * (a * (a * a))) / (t_0 * t_0)) - (c * ((a * (c / b)) / b))) + ((((c * (c * c)) * (a * (a * -2.0))) / (b * t_0)) - c)) / b;
}
def code(a, b, c):
	t_0 = b * (b * b)
	return (((((c * (c * ((c * c) * -5.0))) * (a * (a * a))) / (t_0 * t_0)) - (c * ((a * (c / b)) / b))) + ((((c * (c * c)) * (a * (a * -2.0))) / (b * t_0)) - c)) / b
function code(a, b, c)
	t_0 = Float64(b * Float64(b * b))
	return Float64(Float64(Float64(Float64(Float64(Float64(c * Float64(c * Float64(Float64(c * c) * -5.0))) * Float64(a * Float64(a * a))) / Float64(t_0 * t_0)) - Float64(c * Float64(Float64(a * Float64(c / b)) / b))) + Float64(Float64(Float64(Float64(c * Float64(c * c)) * Float64(a * Float64(a * -2.0))) / Float64(b * t_0)) - c)) / b)
end
function tmp = code(a, b, c)
	t_0 = b * (b * b);
	tmp = (((((c * (c * ((c * c) * -5.0))) * (a * (a * a))) / (t_0 * t_0)) - (c * ((a * (c / b)) / b))) + ((((c * (c * c)) * (a * (a * -2.0))) / (b * t_0)) - c)) / b;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(N[(N[(c * N[(c * N[(N[(c * c), $MachinePrecision] * -5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] - N[(c * N[(N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision] * N[(a * N[(a * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b * t$95$0), $MachinePrecision]), $MachinePrecision] - c), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := b \cdot \left(b \cdot b\right)\\
\frac{\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{t\_0 \cdot t\_0} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \left(\frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot t\_0} - c\right)}{b}
\end{array}
\end{array}
Derivation
  1. Initial program 54.2%

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

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

    \[\leadsto \color{blue}{\frac{\frac{\left(\left(c \cdot \left(c \cdot c\right)\right) \cdot -2\right) \cdot \left(a \cdot a\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + \left(\left(\left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{20}{a}\right) \cdot \frac{-0.25}{{b}^{6}} - \left(c + a \cdot \left(c \cdot \frac{\frac{c}{b}}{b}\right)\right)\right)}{b}} \]
  5. Applied egg-rr91.5%

    \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot c\right) \cdot \left(c \cdot \left(-2 \cdot \left(a \cdot a\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)} + \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) \cdot \left(\left(c \cdot \left(c \cdot \left(c \cdot c\right)\right)\right) \cdot \frac{-5}{a \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)}\right)\right) - \frac{c \cdot a}{\frac{b}{\frac{c}{b}}}\right) - c}}{b} \]
  6. Applied egg-rr91.5%

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

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

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

Alternative 8: 90.6% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := b \cdot \left(b \cdot b\right)\\ \frac{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{t\_0 \cdot t\_0} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot t\_0}\right) - c}{b} \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* b (* b b))))
   (/
    (-
     (+
      (-
       (/ (* (* c (* c (* (* c c) -5.0))) (* a (* a a))) (* t_0 t_0))
       (* c (/ (* a (/ c b)) b)))
      (/ (* (* c (* c c)) (* a (* a -2.0))) (* b t_0)))
     c)
    b)))
double code(double a, double b, double c) {
	double t_0 = b * (b * b);
	return ((((((c * (c * ((c * c) * -5.0))) * (a * (a * a))) / (t_0 * t_0)) - (c * ((a * (c / b)) / b))) + (((c * (c * c)) * (a * (a * -2.0))) / (b * t_0))) - c) / b;
}
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
    t_0 = b * (b * b)
    code = ((((((c * (c * ((c * c) * (-5.0d0)))) * (a * (a * a))) / (t_0 * t_0)) - (c * ((a * (c / b)) / b))) + (((c * (c * c)) * (a * (a * (-2.0d0)))) / (b * t_0))) - c) / b
end function
public static double code(double a, double b, double c) {
	double t_0 = b * (b * b);
	return ((((((c * (c * ((c * c) * -5.0))) * (a * (a * a))) / (t_0 * t_0)) - (c * ((a * (c / b)) / b))) + (((c * (c * c)) * (a * (a * -2.0))) / (b * t_0))) - c) / b;
}
def code(a, b, c):
	t_0 = b * (b * b)
	return ((((((c * (c * ((c * c) * -5.0))) * (a * (a * a))) / (t_0 * t_0)) - (c * ((a * (c / b)) / b))) + (((c * (c * c)) * (a * (a * -2.0))) / (b * t_0))) - c) / b
function code(a, b, c)
	t_0 = Float64(b * Float64(b * b))
	return Float64(Float64(Float64(Float64(Float64(Float64(Float64(c * Float64(c * Float64(Float64(c * c) * -5.0))) * Float64(a * Float64(a * a))) / Float64(t_0 * t_0)) - Float64(c * Float64(Float64(a * Float64(c / b)) / b))) + Float64(Float64(Float64(c * Float64(c * c)) * Float64(a * Float64(a * -2.0))) / Float64(b * t_0))) - c) / b)
end
function tmp = code(a, b, c)
	t_0 = b * (b * b);
	tmp = ((((((c * (c * ((c * c) * -5.0))) * (a * (a * a))) / (t_0 * t_0)) - (c * ((a * (c / b)) / b))) + (((c * (c * c)) * (a * (a * -2.0))) / (b * t_0))) - c) / b;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(N[(N[(N[(c * N[(c * N[(N[(c * c), $MachinePrecision] * -5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] - N[(c * N[(N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(c * N[(c * c), $MachinePrecision]), $MachinePrecision] * N[(a * N[(a * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(b * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - c), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := b \cdot \left(b \cdot b\right)\\
\frac{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{t\_0 \cdot t\_0} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot t\_0}\right) - c}{b}
\end{array}
\end{array}
Derivation
  1. Initial program 54.2%

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

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

    \[\leadsto \color{blue}{\frac{\frac{\left(\left(c \cdot \left(c \cdot c\right)\right) \cdot -2\right) \cdot \left(a \cdot a\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + \left(\left(\left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{20}{a}\right) \cdot \frac{-0.25}{{b}^{6}} - \left(c + a \cdot \left(c \cdot \frac{\frac{c}{b}}{b}\right)\right)\right)}{b}} \]
  5. Applied egg-rr91.5%

    \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot c\right) \cdot \left(c \cdot \left(-2 \cdot \left(a \cdot a\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)} + \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) \cdot \left(\left(c \cdot \left(c \cdot \left(c \cdot c\right)\right)\right) \cdot \frac{-5}{a \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)}\right)\right) - \frac{c \cdot a}{\frac{b}{\frac{c}{b}}}\right) - c}}{b} \]
  6. Applied egg-rr91.5%

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

    \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot -5\right)\right)\right) \cdot \left(a \cdot \left(a \cdot a\right)\right)}{\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)} - c \cdot \frac{a \cdot \frac{c}{b}}{b}\right) + \frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(a \cdot \left(a \cdot -2\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)}\right) - c}}{b} \]
  8. Add Preprocessing

Alternative 9: 87.4% accurate, 4.0× speedup?

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

\\
\frac{\frac{\frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(\left(a \cdot a\right) \cdot -2\right)}{b \cdot b} - a \cdot \left(c \cdot c\right)}{b \cdot b} - c}{b}
\end{array}
Derivation
  1. Initial program 54.2%

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

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

    \[\leadsto \color{blue}{\frac{\frac{\left(\left(c \cdot \left(c \cdot c\right)\right) \cdot -2\right) \cdot \left(a \cdot a\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + \left(\left(\left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{20}{a}\right) \cdot \frac{-0.25}{{b}^{6}} - \left(c + a \cdot \left(c \cdot \frac{\frac{c}{b}}{b}\right)\right)\right)}{b}} \]
  5. Applied egg-rr91.5%

    \[\leadsto \frac{\color{blue}{\left(\left(\frac{\left(c \cdot c\right) \cdot \left(c \cdot \left(-2 \cdot \left(a \cdot a\right)\right)\right)}{b \cdot \left(b \cdot \left(b \cdot b\right)\right)} + \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) \cdot \left(\left(c \cdot \left(c \cdot \left(c \cdot c\right)\right)\right) \cdot \frac{-5}{a \cdot \left(\left(b \cdot b\right) \cdot \left(b \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\right)}\right)\right) - \frac{c \cdot a}{\frac{b}{\frac{c}{b}}}\right) - c}}{b} \]
  6. Taylor expanded in b around inf

    \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\color{blue}{\left(\frac{-2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{2}} - a \cdot {c}^{2}}{{b}^{2}}\right)}, c\right), b\right) \]
  7. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{2}} - a \cdot {c}^{2}\right), \left({b}^{2}\right)\right), c\right), b\right) \]
  8. Simplified88.5%

    \[\leadsto \frac{\color{blue}{\frac{\frac{\left(-2 \cdot \left(a \cdot a\right)\right) \cdot \left(c \cdot \left(c \cdot c\right)\right)}{b \cdot b} - a \cdot \left(c \cdot c\right)}{b \cdot b}} - c}{b} \]
  9. Final simplification88.5%

    \[\leadsto \frac{\frac{\frac{\left(c \cdot \left(c \cdot c\right)\right) \cdot \left(\left(a \cdot a\right) \cdot -2\right)}{b \cdot b} - a \cdot \left(c \cdot c\right)}{b \cdot b} - c}{b} \]
  10. Add Preprocessing

Alternative 10: 87.3% accurate, 4.0× speedup?

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\left(\left(c \cdot \left(c \cdot c\right)\right) \cdot -2\right) \cdot \left(a \cdot a\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + \left(\left(\left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{20}{a}\right) \cdot \frac{-0.25}{{b}^{6}} - \left(c + a \cdot \left(c \cdot \frac{\frac{c}{b}}{b}\right)\right)\right)}{b}} \]
  5. Taylor expanded in c around 0

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(c \cdot \left(c \cdot \left(-2 \cdot \frac{{a}^{2} \cdot c}{{b}^{4}} - \frac{a}{{b}^{2}}\right) - 1\right)\right)}, b\right) \]
  6. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \left(c \cdot \left(-2 \cdot \frac{{a}^{2} \cdot c}{{b}^{4}} - \frac{a}{{b}^{2}}\right) - 1\right)\right), b\right) \]
    2. sub-negN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \left(c \cdot \left(-2 \cdot \frac{{a}^{2} \cdot c}{{b}^{4}} - \frac{a}{{b}^{2}}\right) + \left(\mathsf{neg}\left(1\right)\right)\right)\right), b\right) \]
    3. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \left(c \cdot \left(-2 \cdot \frac{{a}^{2} \cdot c}{{b}^{4}} - \frac{a}{{b}^{2}}\right) + -1\right)\right), b\right) \]
    4. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\left(c \cdot \left(-2 \cdot \frac{{a}^{2} \cdot c}{{b}^{4}} - \frac{a}{{b}^{2}}\right)\right), -1\right)\right), b\right) \]
  7. Simplified88.3%

    \[\leadsto \frac{\color{blue}{c \cdot \left(c \cdot \left(\frac{-2 \cdot \left(c \cdot \left(a \cdot a\right)\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} - \frac{a}{b \cdot b}\right) + -1\right)}}{b} \]
  8. Add Preprocessing

Alternative 11: 81.3% accurate, 7.7× speedup?

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

\\
\frac{\left(0 - c\right) - \frac{a}{b} \cdot \frac{c \cdot c}{b}}{b}
\end{array}
Derivation
  1. Initial program 54.2%

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

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

    \[\leadsto \color{blue}{\frac{\frac{\left(\left(c \cdot \left(c \cdot c\right)\right) \cdot -2\right) \cdot \left(a \cdot a\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + \left(\left(\left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{20}{a}\right) \cdot \frac{-0.25}{{b}^{6}} - \left(c + a \cdot \left(c \cdot \frac{\frac{c}{b}}{b}\right)\right)\right)}{b}} \]
  5. Taylor expanded in a around 0

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} - c\right)}, b\right) \]
  6. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \left(\mathsf{neg}\left(c\right)\right)\right), b\right) \]
    2. mul-1-negN/A

      \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + -1 \cdot c\right), b\right) \]
    3. +-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot c + -1 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}\right), b\right) \]
    4. mul-1-negN/A

      \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot c + \left(\mathsf{neg}\left(\frac{a \cdot {c}^{2}}{{b}^{2}}\right)\right)\right), b\right) \]
    5. unsub-negN/A

      \[\leadsto \mathsf{/.f64}\left(\left(-1 \cdot c - \frac{a \cdot {c}^{2}}{{b}^{2}}\right), b\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(-1 \cdot c\right), \left(\frac{a \cdot {c}^{2}}{{b}^{2}}\right)\right), b\right) \]
    7. mul-1-negN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\mathsf{neg}\left(c\right)\right), \left(\frac{a \cdot {c}^{2}}{{b}^{2}}\right)\right), b\right) \]
    8. neg-sub0N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(0 - c\right), \left(\frac{a \cdot {c}^{2}}{{b}^{2}}\right)\right), b\right) \]
    9. --lowering--.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(0, c\right), \left(\frac{a \cdot {c}^{2}}{{b}^{2}}\right)\right), b\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(0, c\right), \left(\frac{a \cdot {c}^{2}}{b \cdot b}\right)\right), b\right) \]
    11. times-fracN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(0, c\right), \left(\frac{a}{b} \cdot \frac{{c}^{2}}{b}\right)\right), b\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(0, c\right), \mathsf{*.f64}\left(\left(\frac{a}{b}\right), \left(\frac{{c}^{2}}{b}\right)\right)\right), b\right) \]
    13. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(0, c\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(a, b\right), \left(\frac{{c}^{2}}{b}\right)\right)\right), b\right) \]
    14. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(0, c\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(a, b\right), \mathsf{/.f64}\left(\left({c}^{2}\right), b\right)\right)\right), b\right) \]
    15. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(0, c\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(a, b\right), \mathsf{/.f64}\left(\left(c \cdot c\right), b\right)\right)\right), b\right) \]
    16. *-lowering-*.f6482.1%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(0, c\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(a, b\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, c\right), b\right)\right)\right), b\right) \]
  7. Simplified82.1%

    \[\leadsto \frac{\color{blue}{\left(0 - c\right) - \frac{a}{b} \cdot \frac{c \cdot c}{b}}}{b} \]
  8. Add Preprocessing

Alternative 12: 81.2% accurate, 7.7× speedup?

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

\\
c \cdot \left(\frac{-1}{b} - \frac{a \cdot c}{b \cdot \left(b \cdot b\right)}\right)
\end{array}
Derivation
  1. Initial program 54.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Add Preprocessing
  3. Taylor expanded in c around 0

    \[\leadsto \color{blue}{c \cdot \left(-1 \cdot \frac{a \cdot c}{{b}^{3}} - \frac{1}{b}\right)} \]
  4. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto c \cdot \left(-1 \cdot \frac{a \cdot c}{{b}^{3}} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{b}\right)\right)}\right) \]
    2. distribute-neg-fracN/A

      \[\leadsto c \cdot \left(-1 \cdot \frac{a \cdot c}{{b}^{3}} + \frac{\mathsf{neg}\left(1\right)}{\color{blue}{b}}\right) \]
    3. metadata-evalN/A

      \[\leadsto c \cdot \left(-1 \cdot \frac{a \cdot c}{{b}^{3}} + \frac{-1}{b}\right) \]
    4. associate-*r/N/A

      \[\leadsto c \cdot \left(\frac{-1 \cdot \left(a \cdot c\right)}{{b}^{3}} + \frac{\color{blue}{-1}}{b}\right) \]
    5. associate-*r*N/A

      \[\leadsto c \cdot \left(\frac{\left(-1 \cdot a\right) \cdot c}{{b}^{3}} + \frac{-1}{b}\right) \]
    6. associate-*l/N/A

      \[\leadsto c \cdot \left(\frac{-1 \cdot a}{{b}^{3}} \cdot c + \frac{\color{blue}{-1}}{b}\right) \]
    7. associate-*r/N/A

      \[\leadsto c \cdot \left(\left(-1 \cdot \frac{a}{{b}^{3}}\right) \cdot c + \frac{-1}{b}\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(c, \color{blue}{\left(\left(-1 \cdot \frac{a}{{b}^{3}}\right) \cdot c + \frac{-1}{b}\right)}\right) \]
    9. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(c, \left(\frac{-1}{b} + \color{blue}{\left(-1 \cdot \frac{a}{{b}^{3}}\right) \cdot c}\right)\right) \]
    10. associate-*r/N/A

      \[\leadsto \mathsf{*.f64}\left(c, \left(\frac{-1}{b} + \frac{-1 \cdot a}{{b}^{3}} \cdot c\right)\right) \]
    11. associate-*l/N/A

      \[\leadsto \mathsf{*.f64}\left(c, \left(\frac{-1}{b} + \frac{\left(-1 \cdot a\right) \cdot c}{\color{blue}{{b}^{3}}}\right)\right) \]
    12. associate-*r*N/A

      \[\leadsto \mathsf{*.f64}\left(c, \left(\frac{-1}{b} + \frac{-1 \cdot \left(a \cdot c\right)}{{\color{blue}{b}}^{3}}\right)\right) \]
    13. associate-*r/N/A

      \[\leadsto \mathsf{*.f64}\left(c, \left(\frac{-1}{b} + -1 \cdot \color{blue}{\frac{a \cdot c}{{b}^{3}}}\right)\right) \]
    14. mul-1-negN/A

      \[\leadsto \mathsf{*.f64}\left(c, \left(\frac{-1}{b} + \left(\mathsf{neg}\left(\frac{a \cdot c}{{b}^{3}}\right)\right)\right)\right) \]
    15. unsub-negN/A

      \[\leadsto \mathsf{*.f64}\left(c, \left(\frac{-1}{b} - \color{blue}{\frac{a \cdot c}{{b}^{3}}}\right)\right) \]
    16. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(c, \mathsf{\_.f64}\left(\left(\frac{-1}{b}\right), \color{blue}{\left(\frac{a \cdot c}{{b}^{3}}\right)}\right)\right) \]
  5. Simplified81.9%

    \[\leadsto \color{blue}{c \cdot \left(\frac{-1}{b} - \frac{a \cdot c}{b \cdot \left(b \cdot b\right)}\right)} \]
  6. Add Preprocessing

Alternative 13: 81.2% accurate, 8.9× speedup?

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

\\
\frac{c \cdot \left(-1 - a \cdot \frac{c}{b \cdot b}\right)}{b}
\end{array}
Derivation
  1. Initial program 54.2%

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

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

    \[\leadsto \color{blue}{\frac{\frac{\left(\left(c \cdot \left(c \cdot c\right)\right) \cdot -2\right) \cdot \left(a \cdot a\right)}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + \left(\left(\left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{20}{a}\right) \cdot \frac{-0.25}{{b}^{6}} - \left(c + a \cdot \left(c \cdot \frac{\frac{c}{b}}{b}\right)\right)\right)}{b}} \]
  5. Taylor expanded in c around 0

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(c \cdot \left(-1 \cdot \frac{a \cdot c}{{b}^{2}} - 1\right)\right)}, b\right) \]
  6. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \left(-1 \cdot \frac{a \cdot c}{{b}^{2}} - 1\right)\right), b\right) \]
    2. sub-negN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \left(-1 \cdot \frac{a \cdot c}{{b}^{2}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right), b\right) \]
    3. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \left(-1 \cdot \frac{a \cdot c}{{b}^{2}} + -1\right)\right), b\right) \]
    4. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\left(-1 \cdot \frac{a \cdot c}{{b}^{2}}\right), -1\right)\right), b\right) \]
    5. mul-1-negN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\left(\mathsf{neg}\left(\frac{a \cdot c}{{b}^{2}}\right)\right), -1\right)\right), b\right) \]
    6. neg-sub0N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\left(0 - \frac{a \cdot c}{{b}^{2}}\right), -1\right)\right), b\right) \]
    7. --lowering--.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\mathsf{\_.f64}\left(0, \left(\frac{a \cdot c}{{b}^{2}}\right)\right), -1\right)\right), b\right) \]
    8. associate-/l*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\mathsf{\_.f64}\left(0, \left(a \cdot \frac{c}{{b}^{2}}\right)\right), -1\right)\right), b\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(a, \left(\frac{c}{{b}^{2}}\right)\right)\right), -1\right)\right), b\right) \]
    10. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(a, \mathsf{/.f64}\left(c, \left({b}^{2}\right)\right)\right)\right), -1\right)\right), b\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(a, \mathsf{/.f64}\left(c, \left(b \cdot b\right)\right)\right)\right), -1\right)\right), b\right) \]
    12. *-lowering-*.f6482.0%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \mathsf{+.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(a, \mathsf{/.f64}\left(c, \mathsf{*.f64}\left(b, b\right)\right)\right)\right), -1\right)\right), b\right) \]
  7. Simplified82.0%

    \[\leadsto \frac{\color{blue}{c \cdot \left(\left(0 - a \cdot \frac{c}{b \cdot b}\right) + -1\right)}}{b} \]
  8. Final simplification82.0%

    \[\leadsto \frac{c \cdot \left(-1 - a \cdot \frac{c}{b \cdot b}\right)}{b} \]
  9. Add Preprocessing

Alternative 14: 64.0% accurate, 23.2× speedup?

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

\\
0 - \frac{c}{b}
\end{array}
Derivation
  1. Initial program 54.2%

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

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
  4. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{neg}\left(\frac{c}{b}\right) \]
    2. neg-sub0N/A

      \[\leadsto 0 - \color{blue}{\frac{c}{b}} \]
    3. --lowering--.f64N/A

      \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left(\frac{c}{b}\right)}\right) \]
    4. /-lowering-/.f6465.1%

      \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{/.f64}\left(c, \color{blue}{b}\right)\right) \]
  5. Simplified65.1%

    \[\leadsto \color{blue}{0 - \frac{c}{b}} \]
  6. Step-by-step derivation
    1. sub0-negN/A

      \[\leadsto \mathsf{neg}\left(\frac{c}{b}\right) \]
    2. neg-lowering-neg.f64N/A

      \[\leadsto \mathsf{neg.f64}\left(\left(\frac{c}{b}\right)\right) \]
    3. /-lowering-/.f6465.1%

      \[\leadsto \mathsf{neg.f64}\left(\mathsf{/.f64}\left(c, b\right)\right) \]
  7. Applied egg-rr65.1%

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

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

Alternative 15: 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 54.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)}{\color{blue}{2} \cdot a} \]
    2. unsub-negN/A

      \[\leadsto \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{\color{blue}{2} \cdot a} \]
    3. div-subN/A

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{a \cdot 2} - \frac{b}{a \cdot 2}} \]
  5. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto \frac{1}{\frac{a \cdot 2}{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}} - \frac{\color{blue}{b}}{a \cdot 2} \]
    2. frac-subN/A

      \[\leadsto \frac{1 \cdot \left(a \cdot 2\right) - \frac{a \cdot 2}{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}} \cdot b}{\color{blue}{\frac{a \cdot 2}{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}} \cdot \left(a \cdot 2\right)}} \]
    3. /-lowering-/.f64N/A

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

    \[\leadsto \color{blue}{\frac{1 \cdot \left(a \cdot 2\right) - \frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot b}{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot \left(a \cdot 2\right)}} \]
  7. Step-by-step derivation
    1. div-subN/A

      \[\leadsto \frac{1 \cdot \left(a \cdot 2\right)}{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot \left(a \cdot 2\right)} - \color{blue}{\frac{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot b}{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot \left(a \cdot 2\right)}} \]
    2. sub-negN/A

      \[\leadsto \frac{1 \cdot \left(a \cdot 2\right)}{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot \left(a \cdot 2\right)} + \color{blue}{\left(\mathsf{neg}\left(\frac{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot b}{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot \left(a \cdot 2\right)}\right)\right)} \]
    3. *-lft-identityN/A

      \[\leadsto \frac{a \cdot 2}{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot \left(a \cdot 2\right)} + \left(\mathsf{neg}\left(\frac{\color{blue}{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot b}}{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot \left(a \cdot 2\right)}\right)\right) \]
    4. associate-/l*N/A

      \[\leadsto a \cdot \frac{2}{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot \left(a \cdot 2\right)} + \left(\mathsf{neg}\left(\color{blue}{\frac{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot b}{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot \left(a \cdot 2\right)}}\right)\right) \]
    5. times-fracN/A

      \[\leadsto a \cdot \frac{2}{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}} \cdot \left(a \cdot 2\right)} + \left(\mathsf{neg}\left(\frac{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}}}{\frac{a \cdot 2}{\sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}}} \cdot \frac{b}{a \cdot 2}\right)\right) \]
  8. Applied egg-rr53.7%

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

    \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{b}{a} + \frac{1}{2} \cdot \frac{b}{a}} \]
  10. Step-by-step derivation
    1. distribute-rgt-outN/A

      \[\leadsto \frac{b}{a} \cdot \color{blue}{\left(\frac{-1}{2} + \frac{1}{2}\right)} \]
    2. metadata-evalN/A

      \[\leadsto \frac{b}{a} \cdot 0 \]
    3. mul0-rgt3.2%

      \[\leadsto 0 \]
  11. Simplified3.2%

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

Reproduce

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