Quadratic roots, narrow range

Percentage Accurate: 55.6% → 90.6%
Time: 16.4s
Alternatives: 12
Speedup: 29.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 55.6% 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: 90.6% accurate, 0.1× speedup?

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

\\
\frac{\mathsf{fma}\left(-2, \frac{{c}^{3} \cdot {a}^{2}}{{b}^{4}}, \left(-0.25 \cdot \frac{{\left(c \cdot a\right)}^{4} \cdot \left(20 \cdot {b}^{-6}\right)}{a} - \frac{a \cdot {c}^{2}}{{b}^{2}}\right) - c\right)}{b}
\end{array}
Derivation
  1. Initial program 54.9%

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

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

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

    \[\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}} + -0.25 \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}} \]
  6. Step-by-step derivation
    1. Simplified91.9%

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

        \[\leadsto \frac{\mathsf{fma}\left(-2, \frac{{c}^{3} \cdot {a}^{2}}{{b}^{4}}, \left(-0.25 \cdot \color{blue}{\frac{\left({a}^{4} \cdot {c}^{4}\right) \cdot \frac{20}{{b}^{6}}}{a}} - \frac{a \cdot {c}^{2}}{{b}^{2}}\right) - c\right)}{b} \]
      2. pow-prod-down91.9%

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(-2, \frac{{c}^{3} \cdot {a}^{2}}{{b}^{4}}, \left(-0.25 \cdot \frac{{\left(c \cdot a\right)}^{4} \cdot \left(20 \cdot {b}^{-6}\right)}{a} - \frac{a \cdot {c}^{2}}{{b}^{2}}\right) - c\right)}{b} \]
    5. Add Preprocessing

    Alternative 2: 89.5% accurate, 0.2× speedup?

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

      1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{\frac{{\left({\left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right)}^{1.5}\right)}^{0.3333333333333333} \cdot {\left({\left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right)}^{1.5}\right)}^{0.3333333333333333} - b \cdot b}{{\left({\left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right)}^{1.5}\right)}^{0.3333333333333333} + b}}}{a \cdot 2} \]
        2. pow-prod-down80.2%

          \[\leadsto \frac{\frac{\color{blue}{{\left({\left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right)}^{1.5} \cdot {\left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right)}^{1.5}\right)}^{0.3333333333333333}} - b \cdot b}{{\left({\left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right)}^{1.5}\right)}^{0.3333333333333333} + b}}{a \cdot 2} \]
        3. pow-prod-up80.2%

          \[\leadsto \frac{\frac{{\color{blue}{\left({\left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right)}^{\left(1.5 + 1.5\right)}\right)}}^{0.3333333333333333} - b \cdot b}{{\left({\left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right)}^{1.5}\right)}^{0.3333333333333333} + b}}{a \cdot 2} \]
        4. metadata-eval80.2%

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

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

          \[\leadsto \frac{\frac{\color{blue}{\sqrt[3]{\left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right) \cdot \mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right) \cdot \mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}} - b \cdot b}{{\left({\left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right)}^{1.5}\right)}^{0.3333333333333333} + b}}{a \cdot 2} \]
        7. add-cbrt-cube86.5%

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

          \[\leadsto \frac{\frac{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right) - \color{blue}{{b}^{2}}}{{\left({\left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right)}^{1.5}\right)}^{0.3333333333333333} + b}}{a \cdot 2} \]
        9. pow-pow86.6%

          \[\leadsto \frac{\frac{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right) - {b}^{2}}{\color{blue}{{\left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} + b}}{a \cdot 2} \]
        10. metadata-eval86.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 3: 90.6% accurate, 0.2× speedup?

    \[\begin{array}{l} \\ a \cdot \left(a \cdot \mathsf{fma}\left(-2, \frac{{c}^{3}}{{b}^{5}}, -0.25 \cdot \left(\frac{{c}^{4}}{{b}^{7}} \cdot \left(a \cdot 20\right)\right)\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (-
      (*
       a
       (-
        (*
         a
         (fma
          -2.0
          (/ (pow c 3.0) (pow b 5.0))
          (* -0.25 (* (/ (pow c 4.0) (pow b 7.0)) (* a 20.0)))))
        (/ (pow c 2.0) (pow b 3.0))))
      (/ c b)))
    double code(double a, double b, double c) {
    	return (a * ((a * fma(-2.0, (pow(c, 3.0) / pow(b, 5.0)), (-0.25 * ((pow(c, 4.0) / pow(b, 7.0)) * (a * 20.0))))) - (pow(c, 2.0) / pow(b, 3.0)))) - (c / b);
    }
    
    function code(a, b, c)
    	return Float64(Float64(a * Float64(Float64(a * fma(-2.0, Float64((c ^ 3.0) / (b ^ 5.0)), Float64(-0.25 * Float64(Float64((c ^ 4.0) / (b ^ 7.0)) * Float64(a * 20.0))))) - Float64((c ^ 2.0) / (b ^ 3.0)))) - Float64(c / b))
    end
    
    code[a_, b_, c_] := N[(N[(a * N[(N[(a * N[(-2.0 * N[(N[Power[c, 3.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] + N[(-0.25 * N[(N[(N[Power[c, 4.0], $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision] * N[(a * 20.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    a \cdot \left(a \cdot \mathsf{fma}\left(-2, \frac{{c}^{3}}{{b}^{5}}, -0.25 \cdot \left(\frac{{c}^{4}}{{b}^{7}} \cdot \left(a \cdot 20\right)\right)\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}
    \end{array}
    
    Derivation
    1. Initial program 54.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 4: 89.4% accurate, 0.2× speedup?

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

      1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 5: 89.4% accurate, 0.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -17.4:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(-2 \cdot \left(a \cdot \frac{{c}^{3}}{{b}^{5}}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) -17.4)
       (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* a 2.0))
       (-
        (*
         a
         (-
          (* -2.0 (* a (/ (pow c 3.0) (pow b 5.0))))
          (/ (pow c 2.0) (pow b 3.0))))
        (/ c b))))
    double code(double a, double b, double c) {
    	double tmp;
    	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -17.4) {
    		tmp = (sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (a * 2.0);
    	} else {
    		tmp = (a * ((-2.0 * (a * (pow(c, 3.0) / pow(b, 5.0)))) - (pow(c, 2.0) / pow(b, 3.0)))) - (c / b);
    	}
    	return tmp;
    }
    
    function code(a, b, c)
    	tmp = 0.0
    	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) <= -17.4)
    		tmp = Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(a * 2.0));
    	else
    		tmp = Float64(Float64(a * Float64(Float64(-2.0 * Float64(a * Float64((c ^ 3.0) / (b ^ 5.0)))) - Float64((c ^ 2.0) / (b ^ 3.0)))) - Float64(c / b));
    	end
    	return tmp
    end
    
    code[a_, b_, c_] := If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -17.4], N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[(-2.0 * N[(a * N[(N[Power[c, 3.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -17.4:\\
    \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\
    
    \mathbf{else}:\\
    \;\;\;\;a \cdot \left(-2 \cdot \left(a \cdot \frac{{c}^{3}}{{b}^{5}}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -17.399999999999999

      1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 6: 89.2% accurate, 0.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -17.4:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(c \cdot \left(-2 \cdot \frac{c \cdot {a}^{2}}{{b}^{5}} - \frac{a}{{b}^{3}}\right) + \frac{-1}{b}\right)\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0)) -17.4)
       (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* a 2.0))
       (*
        c
        (+
         (* c (- (* -2.0 (/ (* c (pow a 2.0)) (pow b 5.0))) (/ a (pow b 3.0))))
         (/ -1.0 b)))))
    double code(double a, double b, double c) {
    	double tmp;
    	if (((sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)) <= -17.4) {
    		tmp = (sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (a * 2.0);
    	} else {
    		tmp = c * ((c * ((-2.0 * ((c * pow(a, 2.0)) / pow(b, 5.0))) - (a / pow(b, 3.0)))) + (-1.0 / b));
    	}
    	return tmp;
    }
    
    function code(a, b, c)
    	tmp = 0.0
    	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0)) <= -17.4)
    		tmp = Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(a * 2.0));
    	else
    		tmp = Float64(c * Float64(Float64(c * Float64(Float64(-2.0 * Float64(Float64(c * (a ^ 2.0)) / (b ^ 5.0))) - Float64(a / (b ^ 3.0)))) + Float64(-1.0 / b)));
    	end
    	return tmp
    end
    
    code[a_, b_, c_] := If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], -17.4], N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(c * N[(N[(-2.0 * N[(N[(c * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -17.4:\\
    \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\
    
    \mathbf{else}:\\
    \;\;\;\;c \cdot \left(c \cdot \left(-2 \cdot \frac{c \cdot {a}^{2}}{{b}^{5}} - \frac{a}{{b}^{3}}\right) + \frac{-1}{b}\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 4 binary64) a) c)))) (*.f64 #s(literal 2 binary64) a)) < -17.399999999999999

      1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 7: 84.3% accurate, 0.5× speedup?

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

      1. Initial program 77.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 190 < b

      1. Initial program 43.9%

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

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

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

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

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

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

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

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

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

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

    Alternative 8: 84.3% accurate, 0.5× speedup?

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

      1. Initial program 77.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 190 < b

      1. Initial program 43.9%

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

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

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

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

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

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

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

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

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

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

    Alternative 9: 84.3% accurate, 1.0× speedup?

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

      1. Initial program 77.6%

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

      if 190 < b

      1. Initial program 43.9%

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

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

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

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

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

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

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

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

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

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

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

    Alternative 10: 81.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

    Alternative 11: 81.2% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

    Alternative 12: 64.2% accurate, 29.0× speedup?

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

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

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

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

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

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

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

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

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

    Reproduce

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