Quadratic roots, full range

Percentage Accurate: 53.3% → 83.0%
Time: 10.6s
Alternatives: 7
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 7 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: 53.3% 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: 83.0% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;b \leq 3.5 \cdot 10^{-65}:\\
\;\;\;\;\frac{-1}{a \cdot \frac{2}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)}}\\

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


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

    1. Initial program 68.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. neg-sub068.4%

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/68.1%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    6. Simplified94.2%

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

    if -7.5000000000000005e-54 < b < 3.50000000000000005e-65

    1. Initial program 76.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. neg-sub076.6%

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/76.5%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot -0.5}}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity76.5%

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

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

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

        \[\leadsto \frac{1}{\frac{1}{b - \sqrt{\color{blue}{\sqrt{a \cdot \left(c \cdot -4\right)} \cdot \sqrt{a \cdot \left(c \cdot -4\right)}} + b \cdot b}} \cdot \frac{a}{-0.5}} \]
      5. hypot-def79.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1}{a \cdot \frac{2}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot \color{blue}{\left(\sqrt{-4} \cdot \sqrt{-4}\right)}\right)}, b\right)}} \]
      14. rem-square-sqrt79.1%

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

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

    if 3.50000000000000005e-65 < b

    1. Initial program 14.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. neg-sub014.6%

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/14.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. mul-1-neg87.8%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac87.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -7.5 \cdot 10^{-54}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 3.5 \cdot 10^{-65}:\\ \;\;\;\;\frac{-1}{a \cdot \frac{2}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 2: 84.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -3.65 \cdot 10^{-6}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 8.8 \cdot 10^{-63}:\\ \;\;\;\;\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 -3.65e-6)
   (/ (- b) a)
   (if (<= b 8.8e-63)
     (/ (- (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 <= -3.65e-6) {
		tmp = -b / a;
	} else if (b <= 8.8e-63) {
		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 <= (-3.65d-6)) then
        tmp = -b / a
    else if (b <= 8.8d-63) 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 <= -3.65e-6) {
		tmp = -b / a;
	} else if (b <= 8.8e-63) {
		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 <= -3.65e-6:
		tmp = -b / a
	elif b <= 8.8e-63:
		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 <= -3.65e-6)
		tmp = Float64(Float64(-b) / a);
	elseif (b <= 8.8e-63)
		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 <= -3.65e-6)
		tmp = -b / a;
	elseif (b <= 8.8e-63)
		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, -3.65e-6], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 8.8e-63], 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 -3.65 \cdot 10^{-6}:\\
\;\;\;\;\frac{-b}{a}\\

\mathbf{elif}\;b \leq 8.8 \cdot 10^{-63}:\\
\;\;\;\;\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 < -3.65000000000000021e-6

    1. Initial program 65.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. neg-sub065.9%

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/65.6%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    6. Simplified96.1%

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

    if -3.65000000000000021e-6 < b < 8.7999999999999998e-63

    1. Initial program 77.8%

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

    if 8.7999999999999998e-63 < b

    1. Initial program 14.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. neg-sub014.6%

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/14.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. mul-1-neg87.8%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac87.8%

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

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

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

Alternative 3: 80.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.02 \cdot 10^{-58}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 2.9 \cdot 10^{-65}:\\ \;\;\;\;-0.5 \cdot \frac{b - \sqrt{a \cdot \left(c \cdot -4\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.02e-58)
   (- (/ c b) (/ b a))
   (if (<= b 2.9e-65)
     (* -0.5 (/ (- b (sqrt (* a (* c -4.0)))) a))
     (/ (- c) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.02e-58) {
		tmp = (c / b) - (b / a);
	} else if (b <= 2.9e-65) {
		tmp = -0.5 * ((b - sqrt((a * (c * -4.0)))) / 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 <= (-1.02d-58)) then
        tmp = (c / b) - (b / a)
    else if (b <= 2.9d-65) then
        tmp = (-0.5d0) * ((b - sqrt((a * (c * (-4.0d0))))) / 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 <= -1.02e-58) {
		tmp = (c / b) - (b / a);
	} else if (b <= 2.9e-65) {
		tmp = -0.5 * ((b - Math.sqrt((a * (c * -4.0)))) / a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.02e-58:
		tmp = (c / b) - (b / a)
	elif b <= 2.9e-65:
		tmp = -0.5 * ((b - math.sqrt((a * (c * -4.0)))) / a)
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.02e-58)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif (b <= 2.9e-65)
		tmp = Float64(-0.5 * Float64(Float64(b - sqrt(Float64(a * Float64(c * -4.0)))) / a));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.02e-58)
		tmp = (c / b) - (b / a);
	elseif (b <= 2.9e-65)
		tmp = -0.5 * ((b - sqrt((a * (c * -4.0)))) / a);
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.02e-58], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.9e-65], N[(-0.5 * N[(N[(b - N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 68.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. neg-sub068.4%

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/68.1%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    6. Simplified94.2%

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

    if -1.0199999999999999e-58 < b < 2.8999999999999998e-65

    1. Initial program 76.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. neg-sub076.6%

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/76.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(b - \sqrt{\left(-\color{blue}{4 \cdot a}\right) \cdot c + b \cdot b}\right) \cdot \frac{-0.5}{a} \]
      7. distribute-lft-neg-in76.5%

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

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

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

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

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

      \[\leadsto \left(b - \color{blue}{{\left({\left(\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)\right)}^{0.25}\right)}^{2}}\right) \cdot \frac{-0.5}{a} \]
    6. Taylor expanded in a around inf 41.3%

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

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

      if 2.8999999999999998e-65 < b

      1. Initial program 14.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. neg-sub014.6%

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

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

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

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/14.5%

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

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

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

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

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
      5. Step-by-step derivation
        1. mul-1-neg87.8%

          \[\leadsto \color{blue}{-\frac{c}{b}} \]
        2. distribute-neg-frac87.8%

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.02 \cdot 10^{-58}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 2.9 \cdot 10^{-65}:\\ \;\;\;\;-0.5 \cdot \frac{b - \sqrt{a \cdot \left(c \cdot -4\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

    Alternative 4: 67.6% 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 71.7%

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

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

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

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

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/71.5%

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

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

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

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

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

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

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

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

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

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

      if -1.999999999999994e-310 < b

      1. Initial program 31.7%

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

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

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

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

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/31.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
      5. Step-by-step derivation
        1. mul-1-neg68.9%

          \[\leadsto \color{blue}{-\frac{c}{b}} \]
        2. distribute-neg-frac68.9%

          \[\leadsto \color{blue}{\frac{-c}{b}} \]
      6. Simplified68.9%

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

      \[\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 5: 43.3% accurate, 19.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1.75 \cdot 10^{-16}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b}\\ \end{array} \end{array} \]
    (FPCore (a b c) :precision binary64 (if (<= b 1.75e-16) (/ (- b) a) (/ c b)))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= 1.75e-16) {
    		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 <= 1.75d-16) 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 <= 1.75e-16) {
    		tmp = -b / a;
    	} else {
    		tmp = c / b;
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	tmp = 0
    	if b <= 1.75e-16:
    		tmp = -b / a
    	else:
    		tmp = c / b
    	return tmp
    
    function code(a, b, c)
    	tmp = 0.0
    	if (b <= 1.75e-16)
    		tmp = Float64(Float64(-b) / a);
    	else
    		tmp = Float64(c / b);
    	end
    	return tmp
    end
    
    function tmp_2 = code(a, b, c)
    	tmp = 0.0;
    	if (b <= 1.75e-16)
    		tmp = -b / a;
    	else
    		tmp = c / b;
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := If[LessEqual[b, 1.75e-16], N[((-b) / a), $MachinePrecision], N[(c / b), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq 1.75 \cdot 10^{-16}:\\
    \;\;\;\;\frac{-b}{a}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{c}{b}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if b < 1.75000000000000009e-16

      1. Initial program 70.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. neg-sub070.8%

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

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

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

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/70.6%

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{-b}}{a} \]
      6. Simplified50.1%

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

      if 1.75000000000000009e-16 < b

      1. Initial program 11.2%

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

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

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

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

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/11.2%

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

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

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

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

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

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

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

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

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

          \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{2 \cdot \left(\frac{c \cdot a}{b} \cdot \frac{-0.5}{a}\right)}\right)} - 1 \]
        4. *-commutative28.0%

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{2 \cdot \left(a \cdot c\right)}{b}} \cdot \frac{-0.5}{a} \]
        5. times-frac70.4%

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

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

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

          \[\leadsto \frac{\color{blue}{-1} \cdot \left(a \cdot c\right)}{b \cdot a} \]
        9. *-commutative70.4%

          \[\leadsto \frac{-1 \cdot \color{blue}{\left(c \cdot a\right)}}{b \cdot a} \]
        10. neg-mul-170.4%

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

        \[\leadsto \color{blue}{\frac{-c \cdot a}{b \cdot a}} \]
      9. Step-by-step derivation
        1. expm1-log1p-u64.2%

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

          \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-c \cdot a}{b \cdot a}\right)} - 1} \]
        3. add-sqr-sqrt17.4%

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

          \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{\left(-c \cdot a\right) \cdot \left(-c \cdot a\right)}}}{b \cdot a}\right)} - 1 \]
        5. sqr-neg26.3%

          \[\leadsto e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{\left(c \cdot a\right) \cdot \left(c \cdot a\right)}}}{b \cdot a}\right)} - 1 \]
        6. sqrt-unprod16.9%

          \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{c \cdot a} \cdot \sqrt{c \cdot a}}}{b \cdot a}\right)} - 1 \]
        7. add-sqr-sqrt26.4%

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

          \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{a \cdot c}}{b \cdot a}\right)} - 1 \]
        9. *-commutative26.4%

          \[\leadsto e^{\mathsf{log1p}\left(\frac{a \cdot c}{\color{blue}{a \cdot b}}\right)} - 1 \]
        10. times-frac26.6%

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{a}{a} \cdot \frac{c}{b}\right)} - 1} \]
      11. Step-by-step derivation
        1. expm1-def25.6%

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

          \[\leadsto \color{blue}{\frac{a}{a} \cdot \frac{c}{b}} \]
        3. *-inverses25.7%

          \[\leadsto \color{blue}{1} \cdot \frac{c}{b} \]
        4. *-lft-identity25.7%

          \[\leadsto \color{blue}{\frac{c}{b}} \]
      12. Simplified25.7%

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

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

    Alternative 6: 67.5% accurate, 19.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 9.2 \cdot 10^{-281}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= b 9.2e-281) (/ (- b) a) (/ (- c) b)))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= 9.2e-281) {
    		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 <= 9.2d-281) 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 <= 9.2e-281) {
    		tmp = -b / a;
    	} else {
    		tmp = -c / b;
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	tmp = 0
    	if b <= 9.2e-281:
    		tmp = -b / a
    	else:
    		tmp = -c / b
    	return tmp
    
    function code(a, b, c)
    	tmp = 0.0
    	if (b <= 9.2e-281)
    		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 <= 9.2e-281)
    		tmp = -b / a;
    	else
    		tmp = -c / b;
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := If[LessEqual[b, 9.2e-281], N[((-b) / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq 9.2 \cdot 10^{-281}:\\
    \;\;\;\;\frac{-b}{a}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{-c}{b}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if b < 9.19999999999999956e-281

      1. Initial program 72.3%

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

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

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

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

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/72.1%

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

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

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

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

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

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

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

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

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

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

      if 9.19999999999999956e-281 < b

      1. Initial program 30.0%

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

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

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

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

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/30.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
      5. Step-by-step derivation
        1. mul-1-neg70.5%

          \[\leadsto \color{blue}{-\frac{c}{b}} \]
        2. distribute-neg-frac70.5%

          \[\leadsto \color{blue}{\frac{-c}{b}} \]
      6. Simplified70.5%

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

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

    Alternative 7: 10.6% accurate, 38.7× 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 / b)
    end
    
    function tmp = code(a, b, c)
    	tmp = c / b;
    end
    
    code[a_, b_, c_] := N[(c / b), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{c}{b}
    \end{array}
    
    Derivation
    1. Initial program 51.7%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/51.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{2 \cdot \left(\frac{c \cdot a}{b} \cdot \frac{-0.5}{a}\right)}\right)} - 1 \]
      4. *-commutative11.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{2 \cdot \left(a \cdot c\right)}{b}} \cdot \frac{-0.5}{a} \]
      5. times-frac25.7%

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

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

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

        \[\leadsto \frac{\color{blue}{-1} \cdot \left(a \cdot c\right)}{b \cdot a} \]
      9. *-commutative25.7%

        \[\leadsto \frac{-1 \cdot \color{blue}{\left(c \cdot a\right)}}{b \cdot a} \]
      10. neg-mul-125.7%

        \[\leadsto \frac{\color{blue}{-c \cdot a}}{b \cdot a} \]
    8. Simplified25.7%

      \[\leadsto \color{blue}{\frac{-c \cdot a}{b \cdot a}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u23.3%

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-c \cdot a}{b \cdot a}\right)} - 1} \]
      3. add-sqr-sqrt6.5%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{\left(-c \cdot a\right) \cdot \left(-c \cdot a\right)}}}{b \cdot a}\right)} - 1 \]
      5. sqr-neg9.5%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{c \cdot a} \cdot \sqrt{c \cdot a}}}{b \cdot a}\right)} - 1 \]
      7. add-sqr-sqrt9.9%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{c \cdot a}}{b \cdot a}\right)} - 1 \]
      8. *-commutative9.9%

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

        \[\leadsto e^{\mathsf{log1p}\left(\frac{a \cdot c}{\color{blue}{a \cdot b}}\right)} - 1 \]
      10. times-frac10.1%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{a}{a} \cdot \frac{c}{b}\right)} - 1} \]
    11. Step-by-step derivation
      1. expm1-def9.7%

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

        \[\leadsto \color{blue}{\frac{a}{a} \cdot \frac{c}{b}} \]
      3. *-inverses10.2%

        \[\leadsto \color{blue}{1} \cdot \frac{c}{b} \]
      4. *-lft-identity10.2%

        \[\leadsto \color{blue}{\frac{c}{b}} \]
    12. Simplified10.2%

      \[\leadsto \color{blue}{\frac{c}{b}} \]
    13. Final simplification10.2%

      \[\leadsto \frac{c}{b} \]

    Reproduce

    ?
    herbie shell --seed 2023252 
    (FPCore (a b c)
      :name "Quadratic roots, full range"
      :precision binary64
      (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))