quadp (p42, positive)

Percentage Accurate: 51.7% → 85.0%
Time: 11.8s
Alternatives: 7
Speedup: 19.1×

Specification

?
\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{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(4.0 * Float64(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[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{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: 51.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{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(4.0 * Float64(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[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 85.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 37.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{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 -6.2000000000000003e108 < b < 1.40000000000000002e-48

    1. Initial program 81.2%

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

    if 1.40000000000000002e-48 < b

    1. Initial program 14.9%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + {\left({\color{blue}{\left(\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)\right)}}^{\left(\frac{3}{2}\right)}\right)}^{0.3333333333333333}}{2 \cdot a} \]
      6. distribute-lft-neg-in8.6%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\sqrt[3]{{\left(\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\right)}^{1.5}}}}{2 \cdot a} \]
    6. Step-by-step derivation
      1. clear-num11.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \sqrt{\color{blue}{c \cdot \left(a \cdot -4\right) + b \cdot b}}\right)}\right)}^{-1} \]
      11. add-sqr-sqrt12.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{a \cdot 2}{\log \left(e^{\color{blue}{\left(-b\right)} + \mathsf{hypot}\left(\sqrt{c \cdot \left(-4 \cdot a\right)}, b\right)}\right)}} \]
      5. prod-exp0.3%

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

        \[\leadsto \frac{1}{\frac{a \cdot 2}{\log \color{blue}{\left(e^{\mathsf{hypot}\left(\sqrt{c \cdot \left(-4 \cdot a\right)}, b\right)} \cdot e^{-b}\right)}}} \]
      7. prod-exp15.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 2}{\mathsf{hypot}\left(\sqrt{-4 \cdot \left(c \cdot a\right)}, b\right) - b}}} \]
    10. Taylor expanded in b around inf 0.0%

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{4}{\color{blue}{\sqrt{-4} \cdot \sqrt{-4}}} \cdot \frac{b}{c} + \frac{a}{b}} \]
      6. rem-square-sqrt87.9%

        \[\leadsto \frac{1}{\frac{4}{\color{blue}{-4}} \cdot \frac{b}{c} + \frac{a}{b}} \]
      7. metadata-eval87.9%

        \[\leadsto \frac{1}{\color{blue}{-1} \cdot \frac{b}{c} + \frac{a}{b}} \]
    12. Simplified87.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.2 \cdot 10^{+108}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.4 \cdot 10^{-48}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \end{array} \]

Alternative 2: 79.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 57.3%

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

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

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

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

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

    if -1.4000000000000001e-29 < b < 7.60000000000000005e-48

    1. Initial program 77.7%

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \color{blue}{\left(-4\right) \cdot \left(a \cdot c\right)}\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a} \]
      7. associate-*r*77.5%

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

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

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

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

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

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

    if 7.60000000000000005e-48 < b

    1. Initial program 14.9%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + {\left({\color{blue}{\left(\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)\right)}}^{\left(\frac{3}{2}\right)}\right)}^{0.3333333333333333}}{2 \cdot a} \]
      6. distribute-lft-neg-in8.6%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\sqrt[3]{{\left(\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\right)}^{1.5}}}}{2 \cdot a} \]
    6. Step-by-step derivation
      1. clear-num11.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \sqrt{\color{blue}{c \cdot \left(a \cdot -4\right) + b \cdot b}}\right)}\right)}^{-1} \]
      11. add-sqr-sqrt12.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{a \cdot 2}{\log \left(e^{\color{blue}{\left(-b\right)} + \mathsf{hypot}\left(\sqrt{c \cdot \left(-4 \cdot a\right)}, b\right)}\right)}} \]
      5. prod-exp0.3%

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

        \[\leadsto \frac{1}{\frac{a \cdot 2}{\log \color{blue}{\left(e^{\mathsf{hypot}\left(\sqrt{c \cdot \left(-4 \cdot a\right)}, b\right)} \cdot e^{-b}\right)}}} \]
      7. prod-exp15.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 2}{\mathsf{hypot}\left(\sqrt{-4 \cdot \left(c \cdot a\right)}, b\right) - b}}} \]
    10. Taylor expanded in b around inf 0.0%

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{4}{\color{blue}{\sqrt{-4} \cdot \sqrt{-4}}} \cdot \frac{b}{c} + \frac{a}{b}} \]
      6. rem-square-sqrt87.9%

        \[\leadsto \frac{1}{\frac{4}{\color{blue}{-4}} \cdot \frac{b}{c} + \frac{a}{b}} \]
      7. metadata-eval87.9%

        \[\leadsto \frac{1}{\color{blue}{-1} \cdot \frac{b}{c} + \frac{a}{b}} \]
    12. Simplified87.9%

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

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

Alternative 3: 67.8% accurate, 10.5× speedup?

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

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

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


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

    1. Initial program 67.6%

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

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

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

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

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

    if -1.01999999999999994e-305 < b

    1. Initial program 32.1%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + {\left({\color{blue}{\left(\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)\right)}}^{\left(\frac{3}{2}\right)}\right)}^{0.3333333333333333}}{2 \cdot a} \]
      6. distribute-lft-neg-in21.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\sqrt[3]{{\left(\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\right)}^{1.5}}}}{2 \cdot a} \]
    6. Step-by-step derivation
      1. clear-num25.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \sqrt{\color{blue}{c \cdot \left(a \cdot -4\right) + b \cdot b}}\right)}\right)}^{-1} \]
      11. add-sqr-sqrt30.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{a \cdot 2}{\log \left(e^{\color{blue}{\left(-b\right)} + \mathsf{hypot}\left(\sqrt{c \cdot \left(-4 \cdot a\right)}, b\right)}\right)}} \]
      5. prod-exp2.4%

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

        \[\leadsto \frac{1}{\frac{a \cdot 2}{\log \color{blue}{\left(e^{\mathsf{hypot}\left(\sqrt{c \cdot \left(-4 \cdot a\right)}, b\right)} \cdot e^{-b}\right)}}} \]
      7. prod-exp12.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 2}{\mathsf{hypot}\left(\sqrt{-4 \cdot \left(c \cdot a\right)}, b\right) - b}}} \]
    10. Taylor expanded in b around inf 0.0%

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{4}{\color{blue}{\sqrt{-4} \cdot \sqrt{-4}}} \cdot \frac{b}{c} + \frac{a}{b}} \]
      6. rem-square-sqrt65.6%

        \[\leadsto \frac{1}{\frac{4}{\color{blue}{-4}} \cdot \frac{b}{c} + \frac{a}{b}} \]
      7. metadata-eval65.6%

        \[\leadsto \frac{1}{\color{blue}{-1} \cdot \frac{b}{c} + \frac{a}{b}} \]
    12. Simplified65.6%

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

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

Alternative 4: 68.1% accurate, 12.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \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 -5e-310) (- (/ c b) (/ b a)) (/ (- c) b)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5e-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 <= (-5d-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 <= -5e-310) {
		tmp = (c / b) - (b / a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -5e-310:
		tmp = (c / b) - (b / a)
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -5e-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 <= -5e-310)
		tmp = (c / b) - (b / a);
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -5e-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 -5 \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 < -4.999999999999985e-310

    1. Initial program 67.8%

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 31.5%

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

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

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

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

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

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

Alternative 5: 43.1% accurate, 19.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.8e26

    1. Initial program 66.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    3. 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} \]
    4. Simplified50.1%

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

    if 2.8e26 < b

    1. Initial program 12.6%

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \color{blue}{\left(-4\right) \cdot \left(a \cdot c\right)}\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a} \]
      7. associate-*r*11.1%

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

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

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

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

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

        \[\leadsto \frac{2 \cdot \frac{c \cdot a}{b} + 2 \cdot \color{blue}{\left(-b\right)}}{2 \cdot a} \]
      2. distribute-lft-out2.4%

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

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

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

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

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

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

Alternative 6: 67.9% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 68.4%

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified63.2%

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

    if 4.8e-274 < b

    1. Initial program 28.8%

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

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

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

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

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

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

Alternative 7: 11.0% 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 50.9%

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \color{blue}{\left(-4\right) \cdot \left(a \cdot c\right)}\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a} \]
    7. associate-*r*50.4%

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

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

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

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

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

      \[\leadsto \frac{2 \cdot \frac{c \cdot a}{b} + 2 \cdot \color{blue}{\left(-b\right)}}{2 \cdot a} \]
    2. distribute-lft-out33.9%

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

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

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

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

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

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

Developer target: 70.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\\ \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(4.0 * Float64(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[(4.0 * N[(a * c), $MachinePrecision]), $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 - 4 \cdot \left(a \cdot c\right)}\\
\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 2023309 
(FPCore (a b c)
  :name "quadp (p42, positive)"
  :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)))