The quadratic formula (r1)

Percentage Accurate: 52.0% → 85.3%
Time: 14.0s
Alternatives: 8
Speedup: 19.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 52.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: 85.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(a \cdot 4\right)\\ \mathbf{if}\;b \leq -4 \cdot 10^{+117}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.15 \cdot 10^{-116}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - t_0} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq 3.3 \cdot 10^{+38}:\\ \;\;\;\;\frac{t_0}{b + \mathsf{hypot}\left(b, \sqrt{\left(c \cdot a\right) \cdot -4}\right)} \cdot \frac{-0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* c (* a 4.0))))
   (if (<= b -4e+117)
     (- (/ c b) (/ b a))
     (if (<= b 1.15e-116)
       (/ (- (sqrt (- (* b b) t_0)) b) (* a 2.0))
       (if (<= b 3.3e+38)
         (* (/ t_0 (+ b (hypot b (sqrt (* (* c a) -4.0))))) (/ -0.5 a))
         (/ (- c) b))))))
double code(double a, double b, double c) {
	double t_0 = c * (a * 4.0);
	double tmp;
	if (b <= -4e+117) {
		tmp = (c / b) - (b / a);
	} else if (b <= 1.15e-116) {
		tmp = (sqrt(((b * b) - t_0)) - b) / (a * 2.0);
	} else if (b <= 3.3e+38) {
		tmp = (t_0 / (b + hypot(b, sqrt(((c * a) * -4.0))))) * (-0.5 / a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double t_0 = c * (a * 4.0);
	double tmp;
	if (b <= -4e+117) {
		tmp = (c / b) - (b / a);
	} else if (b <= 1.15e-116) {
		tmp = (Math.sqrt(((b * b) - t_0)) - b) / (a * 2.0);
	} else if (b <= 3.3e+38) {
		tmp = (t_0 / (b + Math.hypot(b, Math.sqrt(((c * a) * -4.0))))) * (-0.5 / a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	t_0 = c * (a * 4.0)
	tmp = 0
	if b <= -4e+117:
		tmp = (c / b) - (b / a)
	elif b <= 1.15e-116:
		tmp = (math.sqrt(((b * b) - t_0)) - b) / (a * 2.0)
	elif b <= 3.3e+38:
		tmp = (t_0 / (b + math.hypot(b, math.sqrt(((c * a) * -4.0))))) * (-0.5 / a)
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	t_0 = Float64(c * Float64(a * 4.0))
	tmp = 0.0
	if (b <= -4e+117)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif (b <= 1.15e-116)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - t_0)) - b) / Float64(a * 2.0));
	elseif (b <= 3.3e+38)
		tmp = Float64(Float64(t_0 / Float64(b + hypot(b, sqrt(Float64(Float64(c * a) * -4.0))))) * Float64(-0.5 / a));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = c * (a * 4.0);
	tmp = 0.0;
	if (b <= -4e+117)
		tmp = (c / b) - (b / a);
	elseif (b <= 1.15e-116)
		tmp = (sqrt(((b * b) - t_0)) - b) / (a * 2.0);
	elseif (b <= 3.3e+38)
		tmp = (t_0 / (b + hypot(b, sqrt(((c * a) * -4.0))))) * (-0.5 / a);
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -4e+117], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.15e-116], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.3e+38], N[(N[(t$95$0 / N[(b + N[Sqrt[b ^ 2 + N[Sqrt[N[(N[(c * a), $MachinePrecision] * -4.0), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 1.15 \cdot 10^{-116}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - t_0} - b}{a \cdot 2}\\

\mathbf{elif}\;b \leq 3.3 \cdot 10^{+38}:\\
\;\;\;\;\frac{t_0}{b + \mathsf{hypot}\left(b, \sqrt{\left(c \cdot a\right) \cdot -4}\right)} \cdot \frac{-0.5}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -4.0000000000000002e117

    1. Initial program 47.7%

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

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

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

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

      \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]

    if -4.0000000000000002e117 < b < 1.15000000000000001e-116

    1. Initial program 86.5%

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

    if 1.15000000000000001e-116 < b < 3.2999999999999999e38

    1. Initial program 49.1%

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

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

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

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

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

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

        \[\leadsto \left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)\right) \cdot \frac{\color{blue}{-0.5}}{a} \]
    5. Simplified48.7%

      \[\leadsto \color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)\right) \cdot \frac{-0.5}{a}} \]
    6. Step-by-step derivation
      1. flip--48.2%

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

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

        \[\leadsto \frac{b \cdot b - \sqrt{b \cdot b + \sqrt{c \cdot \left(a \cdot -4\right)} \cdot \sqrt{c \cdot \left(a \cdot -4\right)}} \cdot \color{blue}{\sqrt{b \cdot b + \sqrt{c \cdot \left(a \cdot -4\right)} \cdot \sqrt{c \cdot \left(a \cdot -4\right)}}}}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      4. add-sqr-sqrt48.2%

        \[\leadsto \frac{b \cdot b - \color{blue}{\left(b \cdot b + \sqrt{c \cdot \left(a \cdot -4\right)} \cdot \sqrt{c \cdot \left(a \cdot -4\right)}\right)}}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      5. add-sqr-sqrt48.3%

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

      \[\leadsto \color{blue}{\frac{b \cdot b - \left(b \cdot b + c \cdot \left(a \cdot -4\right)\right)}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)}} \cdot \frac{-0.5}{a} \]
    8. Step-by-step derivation
      1. associate--r+66.0%

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

        \[\leadsto \frac{\color{blue}{0} - c \cdot \left(a \cdot -4\right)}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      3. rem-square-sqrt0.0%

        \[\leadsto \frac{0 - c \cdot \left(a \cdot \color{blue}{\left(\sqrt{-4} \cdot \sqrt{-4}\right)}\right)}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      4. unpow20.0%

        \[\leadsto \frac{0 - c \cdot \left(a \cdot \color{blue}{{\left(\sqrt{-4}\right)}^{2}}\right)}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      5. neg-sub00.0%

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

        \[\leadsto \frac{\color{blue}{\left(-c\right) \cdot \left(a \cdot {\left(\sqrt{-4}\right)}^{2}\right)}}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      7. neg-mul-10.0%

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

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

        \[\leadsto \frac{\left(-1 \cdot c\right) \cdot \left(\color{blue}{\left(\sqrt{-4} \cdot \sqrt{-4}\right)} \cdot a\right)}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      10. rem-square-sqrt66.0%

        \[\leadsto \frac{\left(-1 \cdot c\right) \cdot \left(\color{blue}{-4} \cdot a\right)}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      11. associate-*r*66.0%

        \[\leadsto \frac{\color{blue}{\left(\left(-1 \cdot c\right) \cdot -4\right) \cdot a}}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      12. neg-mul-166.0%

        \[\leadsto \frac{\left(\color{blue}{\left(-c\right)} \cdot -4\right) \cdot a}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      13. distribute-lft-neg-in66.0%

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

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

        \[\leadsto \frac{\left(c \cdot \color{blue}{4}\right) \cdot a}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      16. associate-*r*66.0%

        \[\leadsto \frac{\color{blue}{c \cdot \left(4 \cdot a\right)}}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      17. *-commutative66.0%

        \[\leadsto \frac{c \cdot \color{blue}{\left(a \cdot 4\right)}}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      18. associate-*r*66.0%

        \[\leadsto \frac{c \cdot \left(a \cdot 4\right)}{b + \mathsf{hypot}\left(b, \sqrt{\color{blue}{\left(c \cdot a\right) \cdot -4}}\right)} \cdot \frac{-0.5}{a} \]
    9. Simplified66.0%

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

    if 3.2999999999999999e38 < b

    1. Initial program 12.2%

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified90.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{+117}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.15 \cdot 10^{-116}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq 3.3 \cdot 10^{+38}:\\ \;\;\;\;\frac{c \cdot \left(a \cdot 4\right)}{b + \mathsf{hypot}\left(b, \sqrt{\left(c \cdot a\right) \cdot -4}\right)} \cdot \frac{-0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 2: 84.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.8 \cdot 10^{+64}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-95} \lor \neg \left(b \leq 3 \cdot 10^{-79}\right) \land b \leq 0.135:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2.8e+64)
   (- (/ c b) (/ b a))
   (if (or (<= b 4e-95) (and (not (<= b 3e-79)) (<= b 0.135)))
     (* (/ -0.5 a) (- b (sqrt (+ (* b b) (* c (* a -4.0))))))
     (/ (- c) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.8e+64) {
		tmp = (c / b) - (b / a);
	} else if ((b <= 4e-95) || (!(b <= 3e-79) && (b <= 0.135))) {
		tmp = (-0.5 / a) * (b - sqrt(((b * b) + (c * (a * -4.0)))));
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-2.8d+64)) then
        tmp = (c / b) - (b / a)
    else if ((b <= 4d-95) .or. (.not. (b <= 3d-79)) .and. (b <= 0.135d0)) then
        tmp = ((-0.5d0) / a) * (b - sqrt(((b * b) + (c * (a * (-4.0d0))))))
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.8e+64) {
		tmp = (c / b) - (b / a);
	} else if ((b <= 4e-95) || (!(b <= 3e-79) && (b <= 0.135))) {
		tmp = (-0.5 / a) * (b - Math.sqrt(((b * b) + (c * (a * -4.0)))));
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -2.8e+64:
		tmp = (c / b) - (b / a)
	elif (b <= 4e-95) or (not (b <= 3e-79) and (b <= 0.135)):
		tmp = (-0.5 / a) * (b - math.sqrt(((b * b) + (c * (a * -4.0)))))
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -2.8e+64)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif ((b <= 4e-95) || (!(b <= 3e-79) && (b <= 0.135)))
		tmp = Float64(Float64(-0.5 / a) * Float64(b - sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -4.0))))));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -2.8e+64)
		tmp = (c / b) - (b / a);
	elseif ((b <= 4e-95) || (~((b <= 3e-79)) && (b <= 0.135)))
		tmp = (-0.5 / a) * (b - sqrt(((b * b) + (c * (a * -4.0)))));
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -2.8e+64], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 4e-95], And[N[Not[LessEqual[b, 3e-79]], $MachinePrecision], LessEqual[b, 0.135]]], 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[((-c) / b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.8 \cdot 10^{+64}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

\mathbf{elif}\;b \leq 4 \cdot 10^{-95} \lor \neg \left(b \leq 3 \cdot 10^{-79}\right) \land b \leq 0.135:\\
\;\;\;\;\frac{-0.5}{a} \cdot \left(b - \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -2.80000000000000024e64

    1. Initial program 55.4%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    4. Simplified97.3%

      \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]

    if -2.80000000000000024e64 < b < 3.99999999999999996e-95 or 3e-79 < b < 0.13500000000000001

    1. Initial program 81.4%

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

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

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

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

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

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

        \[\leadsto \left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)\right) \cdot \frac{\color{blue}{-0.5}}{a} \]
    5. Simplified73.0%

      \[\leadsto \color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)\right) \cdot \frac{-0.5}{a}} \]
    6. Step-by-step derivation
      1. hypot-udef73.0%

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

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

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

    if 3.99999999999999996e-95 < b < 3e-79 or 0.13500000000000001 < b

    1. Initial program 16.5%

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified83.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.8 \cdot 10^{+64}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-95} \lor \neg \left(b \leq 3 \cdot 10^{-79}\right) \land b \leq 0.135:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 3: 84.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.06 \cdot 10^{+117}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.7 \cdot 10^{-94} \lor \neg \left(b \leq 6.3 \cdot 10^{-80}\right) \land b \leq 0.135:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.06e+117)
   (- (/ c b) (/ b a))
   (if (or (<= b 1.7e-94) (and (not (<= b 6.3e-80)) (<= b 0.135)))
     (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* a 2.0))
     (/ (- c) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.06e+117) {
		tmp = (c / b) - (b / a);
	} else if ((b <= 1.7e-94) || (!(b <= 6.3e-80) && (b <= 0.135))) {
		tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-1.06d+117)) then
        tmp = (c / b) - (b / a)
    else if ((b <= 1.7d-94) .or. (.not. (b <= 6.3d-80)) .and. (b <= 0.135d0)) then
        tmp = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (a * 2.0d0)
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.06e+117) {
		tmp = (c / b) - (b / a);
	} else if ((b <= 1.7e-94) || (!(b <= 6.3e-80) && (b <= 0.135))) {
		tmp = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.06e+117:
		tmp = (c / b) - (b / a)
	elif (b <= 1.7e-94) or (not (b <= 6.3e-80) and (b <= 0.135)):
		tmp = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0)
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.06e+117)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif ((b <= 1.7e-94) || (!(b <= 6.3e-80) && (b <= 0.135)))
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.06e+117)
		tmp = (c / b) - (b / a);
	elseif ((b <= 1.7e-94) || (~((b <= 6.3e-80)) && (b <= 0.135)))
		tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (a * 2.0);
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.06e+117], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1.7e-94], And[N[Not[LessEqual[b, 6.3e-80]], $MachinePrecision], LessEqual[b, 0.135]]], 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[((-c) / b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.06 \cdot 10^{+117}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

\mathbf{elif}\;b \leq 1.7 \cdot 10^{-94} \lor \neg \left(b \leq 6.3 \cdot 10^{-80}\right) \land b \leq 0.135:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -1.06e117

    1. Initial program 47.7%

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

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

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

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

      \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]

    if -1.06e117 < b < 1.6999999999999999e-94 or 6.29999999999999966e-80 < b < 0.13500000000000001

    1. Initial program 83.0%

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

    if 1.6999999999999999e-94 < b < 6.29999999999999966e-80 or 0.13500000000000001 < b

    1. Initial program 16.5%

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified83.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.06 \cdot 10^{+117}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.7 \cdot 10^{-94} \lor \neg \left(b \leq 6.3 \cdot 10^{-80}\right) \land b \leq 0.135:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 4: 81.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.4 \cdot 10^{-78}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-94}:\\ \;\;\;\;\frac{\sqrt{\left(c \cdot a\right) \cdot -4} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2.4e-78)
   (- (/ c b) (/ b a))
   (if (<= b 2e-94) (/ (- (sqrt (* (* c a) -4.0)) b) (* a 2.0)) (/ (- c) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.4e-78) {
		tmp = (c / b) - (b / a);
	} else if (b <= 2e-94) {
		tmp = (sqrt(((c * a) * -4.0)) - b) / (a * 2.0);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-2.4d-78)) then
        tmp = (c / b) - (b / a)
    else if (b <= 2d-94) then
        tmp = (sqrt(((c * a) * (-4.0d0))) - b) / (a * 2.0d0)
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.4e-78) {
		tmp = (c / b) - (b / a);
	} else if (b <= 2e-94) {
		tmp = (Math.sqrt(((c * a) * -4.0)) - b) / (a * 2.0);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -2.4e-78:
		tmp = (c / b) - (b / a)
	elif b <= 2e-94:
		tmp = (math.sqrt(((c * a) * -4.0)) - b) / (a * 2.0)
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -2.4e-78)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif (b <= 2e-94)
		tmp = Float64(Float64(sqrt(Float64(Float64(c * a) * -4.0)) - b) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -2.4e-78)
		tmp = (c / b) - (b / a);
	elseif (b <= 2e-94)
		tmp = (sqrt(((c * a) * -4.0)) - b) / (a * 2.0);
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -2.4e-78], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2e-94], N[(N[(N[Sqrt[N[(N[(c * a), $MachinePrecision] * -4.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.4 \cdot 10^{-78}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

\mathbf{elif}\;b \leq 2 \cdot 10^{-94}:\\
\;\;\;\;\frac{\sqrt{\left(c \cdot a\right) \cdot -4} - b}{a \cdot 2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -2.4e-78

    1. Initial program 68.0%

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

      \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
    3. Step-by-step derivation
      1. mul-1-neg93.4%

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    4. Simplified93.4%

      \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]

    if -2.4e-78 < b < 1.9999999999999999e-94

    1. Initial program 80.2%

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{c \cdot \left(a \cdot -4\right)}}}{2 \cdot a} \]
    5. Step-by-step derivation
      1. expm1-log1p-u51.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\log \left(e^{\color{blue}{-1 \cdot b + \sqrt{c \cdot \left(a \cdot -4\right)}}}\right)}{a \cdot 2} \]
      5. neg-mul-15.8%

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

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

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

        \[\leadsto \frac{\log \color{blue}{\left(e^{\sqrt{c \cdot \left(a \cdot -4\right)} + \left(-b\right)}\right)}}{a \cdot 2} \]
      9. rem-log-exp71.8%

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

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

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

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

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

    if 1.9999999999999999e-94 < b

    1. Initial program 23.4%

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified74.3%

      \[\leadsto \color{blue}{\frac{-c}{b}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification81.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.4 \cdot 10^{-78}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-94}:\\ \;\;\;\;\frac{\sqrt{\left(c \cdot a\right) \cdot -4} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 5: 81.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -7.2 \cdot 10^{-71}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 7 \cdot 10^{-95}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -7.2e-71)
   (- (/ c b) (/ b a))
   (if (<= b 7e-95) (/ (- (sqrt (* c (* a -4.0))) b) (* a 2.0)) (/ (- c) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -7.2e-71) {
		tmp = (c / b) - (b / a);
	} else if (b <= 7e-95) {
		tmp = (sqrt((c * (a * -4.0))) - b) / (a * 2.0);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-7.2d-71)) then
        tmp = (c / b) - (b / a)
    else if (b <= 7d-95) then
        tmp = (sqrt((c * (a * (-4.0d0)))) - b) / (a * 2.0d0)
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -7.2e-71) {
		tmp = (c / b) - (b / a);
	} else if (b <= 7e-95) {
		tmp = (Math.sqrt((c * (a * -4.0))) - b) / (a * 2.0);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -7.2e-71:
		tmp = (c / b) - (b / a)
	elif b <= 7e-95:
		tmp = (math.sqrt((c * (a * -4.0))) - b) / (a * 2.0)
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -7.2e-71)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif (b <= 7e-95)
		tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -4.0))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -7.2e-71)
		tmp = (c / b) - (b / a);
	elseif (b <= 7e-95)
		tmp = (sqrt((c * (a * -4.0))) - b) / (a * 2.0);
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -7.2e-71], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-95], N[(N[(N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.2 \cdot 10^{-71}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

\mathbf{elif}\;b \leq 7 \cdot 10^{-95}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -7.2e-71

    1. Initial program 68.0%

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

      \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
    3. Step-by-step derivation
      1. mul-1-neg93.4%

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    4. Simplified93.4%

      \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]

    if -7.2e-71 < b < 6.9999999999999994e-95

    1. Initial program 80.2%

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{e^{\log \left(c \cdot \left(a \cdot -4\right)\right) \cdot 0.5}}}{2 \cdot a} \]
    6. Applied egg-rr67.2%

      \[\leadsto \frac{\left(-b\right) + \color{blue}{e^{\log \left(c \cdot \left(a \cdot -4\right)\right) \cdot 0.5}}}{2 \cdot a} \]
    7. Step-by-step derivation
      1. *-un-lft-identity67.2%

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

        \[\leadsto 1 \cdot \frac{\color{blue}{e^{\log \left(c \cdot \left(a \cdot -4\right)\right) \cdot 0.5} + \left(-b\right)}}{2 \cdot a} \]
      3. exp-to-pow71.8%

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

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

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

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

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

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

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

    if 6.9999999999999994e-95 < b

    1. Initial program 23.4%

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified74.3%

      \[\leadsto \color{blue}{\frac{-c}{b}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification81.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -7.2 \cdot 10^{-71}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 7 \cdot 10^{-95}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 6: 68.2% accurate, 12.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2e-310) (- (/ c b) (/ b a)) (/ (- c) b)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2e-310) {
		tmp = (c / b) - (b / a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-2d-310)) then
        tmp = (c / b) - (b / a)
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -2e-310) {
		tmp = (c / b) - (b / a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -2e-310:
		tmp = (c / b) - (b / a)
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -2e-310)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -2e-310)
		tmp = (c / b) - (b / a);
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -1.999999999999994e-310

    1. Initial program 72.7%

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

      \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
    3. Step-by-step derivation
      1. mul-1-neg76.4%

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    4. Simplified76.4%

      \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]

    if -1.999999999999994e-310 < b

    1. Initial program 36.2%

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified58.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 7: 68.0% accurate, 19.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2e-310) (/ (- b) a) (/ (- c) b)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2e-310) {
		tmp = -b / a;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-2d-310)) then
        tmp = -b / a
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -2e-310) {
		tmp = -b / a;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -2e-310:
		tmp = -b / a
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -2e-310)
		tmp = Float64(Float64(-b) / a);
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -2e-310)
		tmp = -b / a;
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[((-b) / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{-b}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -1.999999999999994e-310

    1. Initial program 72.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot b}{a}} \]
      2. mul-1-neg76.3%

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified76.3%

      \[\leadsto \color{blue}{\frac{-b}{a}} \]

    if -1.999999999999994e-310 < b

    1. Initial program 36.2%

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified58.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 8: 35.6% accurate, 29.0× speedup?

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-b}}{a} \]
  4. Simplified39.6%

    \[\leadsto \color{blue}{\frac{-b}{a}} \]
  5. Final simplification39.6%

    \[\leadsto \frac{-b}{a} \]

Developer target: 70.1% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023279 
(FPCore (a b c)
  :name "The quadratic formula (r1)"
  :precision binary64

  :herbie-target
  (if (< b 0.0) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) (/ c (* a (/ (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))))

  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))