The quadratic formula (r2)

Percentage Accurate: 53.1% → 91.2%
Time: 13.6s
Alternatives: 9
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 9 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.1% 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: 91.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - \left(c \cdot 4\right) \cdot a}\\ \mathbf{if}\;b \leq -2 \cdot 10^{+146}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b + \left(b - \frac{c}{\frac{b}{a}} \cdot 2\right)}\\ \mathbf{elif}\;b \leq -1.1 \cdot 10^{-308}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b - t_0}\\ \mathbf{elif}\;b \leq 2.6 \cdot 10^{+120}:\\ \;\;\;\;-0.5 \cdot \frac{b + t_0}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* (* c 4.0) a)))))
   (if (<= b -2e+146)
     (* -0.5 (/ (* c 4.0) (+ b (- b (* (/ c (/ b a)) 2.0)))))
     (if (<= b -1.1e-308)
       (* -0.5 (/ (* c 4.0) (- b t_0)))
       (if (<= b 2.6e+120) (* -0.5 (/ (+ b t_0) a)) (/ (- b) a))))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - ((c * 4.0) * a)));
	double tmp;
	if (b <= -2e+146) {
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))));
	} else if (b <= -1.1e-308) {
		tmp = -0.5 * ((c * 4.0) / (b - t_0));
	} else if (b <= 2.6e+120) {
		tmp = -0.5 * ((b + t_0) / a);
	} else {
		tmp = -b / 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) - ((c * 4.0d0) * a)))
    if (b <= (-2d+146)) then
        tmp = (-0.5d0) * ((c * 4.0d0) / (b + (b - ((c / (b / a)) * 2.0d0))))
    else if (b <= (-1.1d-308)) then
        tmp = (-0.5d0) * ((c * 4.0d0) / (b - t_0))
    else if (b <= 2.6d+120) then
        tmp = (-0.5d0) * ((b + t_0) / a)
    else
        tmp = -b / a
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt(((b * b) - ((c * 4.0) * a)));
	double tmp;
	if (b <= -2e+146) {
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))));
	} else if (b <= -1.1e-308) {
		tmp = -0.5 * ((c * 4.0) / (b - t_0));
	} else if (b <= 2.6e+120) {
		tmp = -0.5 * ((b + t_0) / a);
	} else {
		tmp = -b / a;
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt(((b * b) - ((c * 4.0) * a)))
	tmp = 0
	if b <= -2e+146:
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))))
	elif b <= -1.1e-308:
		tmp = -0.5 * ((c * 4.0) / (b - t_0))
	elif b <= 2.6e+120:
		tmp = -0.5 * ((b + t_0) / a)
	else:
		tmp = -b / a
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(c * 4.0) * a)))
	tmp = 0.0
	if (b <= -2e+146)
		tmp = Float64(-0.5 * Float64(Float64(c * 4.0) / Float64(b + Float64(b - Float64(Float64(c / Float64(b / a)) * 2.0)))));
	elseif (b <= -1.1e-308)
		tmp = Float64(-0.5 * Float64(Float64(c * 4.0) / Float64(b - t_0)));
	elseif (b <= 2.6e+120)
		tmp = Float64(-0.5 * Float64(Float64(b + t_0) / a));
	else
		tmp = Float64(Float64(-b) / a);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = sqrt(((b * b) - ((c * 4.0) * a)));
	tmp = 0.0;
	if (b <= -2e+146)
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))));
	elseif (b <= -1.1e-308)
		tmp = -0.5 * ((c * 4.0) / (b - t_0));
	elseif (b <= 2.6e+120)
		tmp = -0.5 * ((b + t_0) / a);
	else
		tmp = -b / a;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(c * 4.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -2e+146], N[(-0.5 * N[(N[(c * 4.0), $MachinePrecision] / N[(b + N[(b - N[(N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -1.1e-308], N[(-0.5 * N[(N[(c * 4.0), $MachinePrecision] / N[(b - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.6e+120], N[(-0.5 * N[(N[(b + t$95$0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[((-b) / a), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq -1.1 \cdot 10^{-308}:\\
\;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b - t_0}\\

\mathbf{elif}\;b \leq 2.6 \cdot 10^{+120}:\\
\;\;\;\;-0.5 \cdot \frac{b + t_0}{a}\\

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


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

    1. Initial program 2.0%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified2.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{\frac{b \cdot b - \color{blue}{\left(b \cdot b - a \cdot \left(c \cdot 4\right)\right)}}{b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}{a} \]
    6. Applied egg-rr0.3%

      \[\leadsto -0.5 \cdot \frac{\color{blue}{\frac{b \cdot b - \left(b \cdot b - a \cdot \left(c \cdot 4\right)\right)}{b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}}{a} \]
    7. Step-by-step derivation
      1. associate--r-5.2%

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

        \[\leadsto -0.5 \cdot \frac{\frac{\color{blue}{0} + a \cdot \left(c \cdot 4\right)}{b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}{a} \]
      3. sub-neg44.6%

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}{a}\right)} - 1\right)} \]
      3. +-lft-identity39.7%

        \[\leadsto -0.5 \cdot \left(e^{\mathsf{log1p}\left(\frac{\frac{\color{blue}{a \cdot \left(c \cdot 4\right)}}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}{a}\right)} - 1\right) \]
    10. Applied egg-rr39.7%

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \left(1 \cdot \frac{c \cdot 4}{b - \color{blue}{\left(2 \cdot \frac{c \cdot a}{b} + -1 \cdot b\right)}}\right) \]
    14. Step-by-step derivation
      1. mul-1-neg94.9%

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

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

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

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

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

    if -1.99999999999999987e146 < b < -1.1000000000000001e-308

    1. Initial program 42.6%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified42.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{\frac{b \cdot b - \left(b \cdot b - a \cdot \left(c \cdot 4\right)\right)}{b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}}{a} \]
    7. Step-by-step derivation
      1. associate--r-68.4%

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

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}}{a} \]
    9. Step-by-step derivation
      1. expm1-log1p-u47.8%

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

        \[\leadsto -0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}{a}\right)} - 1\right)} \]
      3. +-lft-identity26.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.1000000000000001e-308 < b < 2.5999999999999999e120

    1. Initial program 81.5%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified81.5%

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

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

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

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

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

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

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

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

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

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

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

    if 2.5999999999999999e120 < b

    1. Initial program 52.1%

      \[\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 96.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{+146}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b + \left(b - \frac{c}{\frac{b}{a}} \cdot 2\right)}\\ \mathbf{elif}\;b \leq -1.1 \cdot 10^{-308}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b - \sqrt{b \cdot b - \left(c \cdot 4\right) \cdot a}}\\ \mathbf{elif}\;b \leq 2.6 \cdot 10^{+120}:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{b \cdot b - \left(c \cdot 4\right) \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]

Alternative 2: 81.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\left(c \cdot a\right) \cdot -4}\\ \mathbf{if}\;b \leq -2.2 \cdot 10^{-59}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b + \left(b - \frac{c}{\frac{b}{a}} \cdot 2\right)}\\ \mathbf{elif}\;b \leq 1.3 \cdot 10^{-121}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b - t_0}\\ \mathbf{elif}\;b \leq 1.7 \cdot 10^{-17} \lor \neg \left(b \leq 2.2\right):\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{b + t_0}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (* (* c a) -4.0))))
   (if (<= b -2.2e-59)
     (* -0.5 (/ (* c 4.0) (+ b (- b (* (/ c (/ b a)) 2.0)))))
     (if (<= b 1.3e-121)
       (* -0.5 (/ (* c 4.0) (- b t_0)))
       (if (or (<= b 1.7e-17) (not (<= b 2.2)))
         (- (/ c b) (/ b a))
         (* -0.5 (/ (+ b t_0) a)))))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((c * a) * -4.0));
	double tmp;
	if (b <= -2.2e-59) {
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))));
	} else if (b <= 1.3e-121) {
		tmp = -0.5 * ((c * 4.0) / (b - t_0));
	} else if ((b <= 1.7e-17) || !(b <= 2.2)) {
		tmp = (c / b) - (b / a);
	} else {
		tmp = -0.5 * ((b + t_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(((c * a) * (-4.0d0)))
    if (b <= (-2.2d-59)) then
        tmp = (-0.5d0) * ((c * 4.0d0) / (b + (b - ((c / (b / a)) * 2.0d0))))
    else if (b <= 1.3d-121) then
        tmp = (-0.5d0) * ((c * 4.0d0) / (b - t_0))
    else if ((b <= 1.7d-17) .or. (.not. (b <= 2.2d0))) then
        tmp = (c / b) - (b / a)
    else
        tmp = (-0.5d0) * ((b + t_0) / a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt(((c * a) * -4.0));
	double tmp;
	if (b <= -2.2e-59) {
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))));
	} else if (b <= 1.3e-121) {
		tmp = -0.5 * ((c * 4.0) / (b - t_0));
	} else if ((b <= 1.7e-17) || !(b <= 2.2)) {
		tmp = (c / b) - (b / a);
	} else {
		tmp = -0.5 * ((b + t_0) / a);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt(((c * a) * -4.0))
	tmp = 0
	if b <= -2.2e-59:
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))))
	elif b <= 1.3e-121:
		tmp = -0.5 * ((c * 4.0) / (b - t_0))
	elif (b <= 1.7e-17) or not (b <= 2.2):
		tmp = (c / b) - (b / a)
	else:
		tmp = -0.5 * ((b + t_0) / a)
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(c * a) * -4.0))
	tmp = 0.0
	if (b <= -2.2e-59)
		tmp = Float64(-0.5 * Float64(Float64(c * 4.0) / Float64(b + Float64(b - Float64(Float64(c / Float64(b / a)) * 2.0)))));
	elseif (b <= 1.3e-121)
		tmp = Float64(-0.5 * Float64(Float64(c * 4.0) / Float64(b - t_0)));
	elseif ((b <= 1.7e-17) || !(b <= 2.2))
		tmp = Float64(Float64(c / b) - Float64(b / a));
	else
		tmp = Float64(-0.5 * Float64(Float64(b + t_0) / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = sqrt(((c * a) * -4.0));
	tmp = 0.0;
	if (b <= -2.2e-59)
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))));
	elseif (b <= 1.3e-121)
		tmp = -0.5 * ((c * 4.0) / (b - t_0));
	elseif ((b <= 1.7e-17) || ~((b <= 2.2)))
		tmp = (c / b) - (b / a);
	else
		tmp = -0.5 * ((b + t_0) / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(c * a), $MachinePrecision] * -4.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -2.2e-59], N[(-0.5 * N[(N[(c * 4.0), $MachinePrecision] / N[(b + N[(b - N[(N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.3e-121], N[(-0.5 * N[(N[(c * 4.0), $MachinePrecision] / N[(b - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1.7e-17], N[Not[LessEqual[b, 2.2]], $MachinePrecision]], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(b + t$95$0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 1.3 \cdot 10^{-121}:\\
\;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b - t_0}\\

\mathbf{elif}\;b \leq 1.7 \cdot 10^{-17} \lor \neg \left(b \leq 2.2\right):\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{b + t_0}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -2.1999999999999999e-59

    1. Initial program 18.3%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified18.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{\frac{b \cdot b - \color{blue}{\left(b \cdot b - a \cdot \left(c \cdot 4\right)\right)}}{b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}{a} \]
    6. Applied egg-rr17.3%

      \[\leadsto -0.5 \cdot \frac{\color{blue}{\frac{b \cdot b - \left(b \cdot b - a \cdot \left(c \cdot 4\right)\right)}{b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}}{a} \]
    7. Step-by-step derivation
      1. associate--r-44.2%

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

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}}{a} \]
    9. Step-by-step derivation
      1. expm1-log1p-u53.0%

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

        \[\leadsto -0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}{a}\right)} - 1\right)} \]
      3. +-lft-identity36.4%

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

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \left(1 \cdot \frac{c \cdot 4}{b - \color{blue}{\left(2 \cdot \frac{c \cdot a}{b} + -1 \cdot b\right)}}\right) \]
    14. Step-by-step derivation
      1. mul-1-neg84.0%

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

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

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

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

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

    if -2.1999999999999999e-59 < b < 1.29999999999999993e-121

    1. Initial program 65.5%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified65.5%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{\frac{b \cdot b - \color{blue}{\left(b \cdot b - a \cdot \left(c \cdot 4\right)\right)}}{b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}{a} \]
    6. Applied egg-rr64.3%

      \[\leadsto -0.5 \cdot \frac{\color{blue}{\frac{b \cdot b - \left(b \cdot b - a \cdot \left(c \cdot 4\right)\right)}{b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}}{a} \]
    7. Step-by-step derivation
      1. associate--r-65.7%

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

        \[\leadsto -0.5 \cdot \frac{\frac{\color{blue}{0} + a \cdot \left(c \cdot 4\right)}{b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}{a} \]
      3. sub-neg65.7%

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}}{a} \]
    9. Step-by-step derivation
      1. expm1-log1p-u43.3%

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

        \[\leadsto -0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}{a}\right)} - 1\right)} \]
      3. +-lft-identity23.4%

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

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

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

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

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

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

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

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

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

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

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

    if 1.29999999999999993e-121 < b < 1.6999999999999999e-17 or 2.2000000000000002 < b

    1. Initial program 68.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 84.6%

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

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

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

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

    if 1.6999999999999999e-17 < b < 2.2000000000000002

    1. Initial program 83.3%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified83.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.2 \cdot 10^{-59}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b + \left(b - \frac{c}{\frac{b}{a}} \cdot 2\right)}\\ \mathbf{elif}\;b \leq 1.3 \cdot 10^{-121}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b - \sqrt{\left(c \cdot a\right) \cdot -4}}\\ \mathbf{elif}\;b \leq 1.7 \cdot 10^{-17} \lor \neg \left(b \leq 2.2\right):\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\left(c \cdot a\right) \cdot -4}}{a}\\ \end{array} \]

Alternative 3: 85.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.1 \cdot 10^{-109}:\\
\;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b + \left(b - \frac{c}{\frac{b}{a}} \cdot 2\right)}\\

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

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


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

    1. Initial program 20.1%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified20.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{\frac{b \cdot b - \left(b \cdot b - a \cdot \left(c \cdot 4\right)\right)}{b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}}{a} \]
    7. Step-by-step derivation
      1. associate--r-44.5%

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\color{blue}{a \cdot \left(-c \cdot 4\right)} + b \cdot b}}}{a} \]
      6. fma-udef60.3%

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}{a}\right)} - 1\right)} \]
      3. +-lft-identity35.2%

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

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \left(1 \cdot \frac{c \cdot 4}{b - \color{blue}{\left(2 \cdot \frac{c \cdot a}{b} + -1 \cdot b\right)}}\right) \]
    14. Step-by-step derivation
      1. mul-1-neg80.3%

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

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

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

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

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

    if -3.1e-109 < b < 4.9999999999999999e119

    1. Initial program 76.7%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified76.7%

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

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

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

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

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

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

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

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

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

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

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

    if 4.9999999999999999e119 < b

    1. Initial program 52.1%

      \[\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 96.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.1 \cdot 10^{-109}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b + \left(b - \frac{c}{\frac{b}{a}} \cdot 2\right)}\\ \mathbf{elif}\;b \leq 5 \cdot 10^{+119}:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{b \cdot b - \left(c \cdot 4\right) \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]

Alternative 4: 80.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -7 \cdot 10^{-121}:\\
\;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b + \left(b - \frac{c}{\frac{b}{a}} \cdot 2\right)}\\

\mathbf{elif}\;b \leq 2.2:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{\left(c \cdot a\right) \cdot -4}}{a}\\

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


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

    1. Initial program 20.1%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified20.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{\frac{b \cdot b - \left(b \cdot b - a \cdot \left(c \cdot 4\right)\right)}{b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}}{a} \]
    7. Step-by-step derivation
      1. associate--r-44.5%

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\color{blue}{a \cdot \left(-c \cdot 4\right)} + b \cdot b}}}{a} \]
      6. fma-udef60.3%

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}{a}\right)} - 1\right)} \]
      3. +-lft-identity35.2%

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

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \left(1 \cdot \frac{c \cdot 4}{b - \color{blue}{\left(2 \cdot \frac{c \cdot a}{b} + -1 \cdot b\right)}}\right) \]
    14. Step-by-step derivation
      1. mul-1-neg80.3%

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

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

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

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

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

    if -6.99999999999999985e-121 < b < 2.2000000000000002

    1. Initial program 73.0%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified73.0%

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

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

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

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

    if 2.2000000000000002 < b

    1. Initial program 64.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 89.1%

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

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

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

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

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

Alternative 5: 67.3% accurate, 6.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b + \left(b - \frac{c}{\frac{b}{a}} \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1e-309)
   (* -0.5 (/ (* c 4.0) (+ b (- b (* (/ c (/ b a)) 2.0)))))
   (- (/ c b) (/ b a))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e-309) {
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))));
	} else {
		tmp = (c / b) - (b / 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) :: tmp
    if (b <= (-1d-309)) then
        tmp = (-0.5d0) * ((c * 4.0d0) / (b + (b - ((c / (b / a)) * 2.0d0))))
    else
        tmp = (c / b) - (b / a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e-309) {
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))));
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1e-309:
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))))
	else:
		tmp = (c / b) - (b / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1e-309)
		tmp = Float64(-0.5 * Float64(Float64(c * 4.0) / Float64(b + Float64(b - Float64(Float64(c / Float64(b / a)) * 2.0)))));
	else
		tmp = Float64(Float64(c / b) - Float64(b / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1e-309)
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))));
	else
		tmp = (c / b) - (b / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1e-309], N[(-0.5 * N[(N[(c * 4.0), $MachinePrecision] / N[(b + N[(b - N[(N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\
\;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b + \left(b - \frac{c}{\frac{b}{a}} \cdot 2\right)}\\

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


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

    1. Initial program 30.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{\frac{b \cdot b - \color{blue}{\left(b \cdot b - a \cdot \left(c \cdot 4\right)\right)}}{b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}{a} \]
    6. Applied egg-rr29.3%

      \[\leadsto -0.5 \cdot \frac{\color{blue}{\frac{b \cdot b - \left(b \cdot b - a \cdot \left(c \cdot 4\right)\right)}{b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}}{a} \]
    7. Step-by-step derivation
      1. associate--r-49.0%

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\color{blue}{a \cdot \left(-c \cdot 4\right)} + b \cdot b}}}{a} \]
      6. fma-udef61.1%

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}}{a} \]
    9. Step-by-step derivation
      1. expm1-log1p-u46.8%

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

        \[\leadsto -0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\frac{0 + a \cdot \left(c \cdot 4\right)}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}{a}\right)} - 1\right)} \]
      3. +-lft-identity30.8%

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

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \left(1 \cdot \frac{c \cdot 4}{b - \color{blue}{\left(2 \cdot \frac{c \cdot a}{b} + -1 \cdot b\right)}}\right) \]
    14. Step-by-step derivation
      1. mul-1-neg68.0%

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

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

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

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

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

    if -1.000000000000002e-309 < b

    1. Initial program 70.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 61.4%

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

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

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

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

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

Alternative 6: 67.2% accurate, 12.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{-c}{b}\\

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


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

    1. Initial program 30.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 68.0%

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

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

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

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

    if -1.000000000000002e-309 < b

    1. Initial program 70.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 61.4%

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

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

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

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

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

Alternative 7: 42.8% accurate, 19.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -75000000:\\
\;\;\;\;\frac{c}{b}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -7.5e7

    1. Initial program 17.1%

      \[\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 2.1%

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

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

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

      \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    5. Taylor expanded in c around inf 29.6%

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

    if -7.5e7 < b

    1. Initial program 64.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 45.0%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified45.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -75000000:\\ \;\;\;\;\frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]

Alternative 8: 67.1% accurate, 19.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{-c}{b}\\

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


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

    1. Initial program 30.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 68.0%

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

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

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

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

    if -1.000000000000002e-309 < b

    1. Initial program 70.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 61.3%

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

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

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

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

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

Alternative 9: 10.5% 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. Taylor expanded in b around inf 32.7%

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

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

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

    \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
  5. Taylor expanded in c around inf 10.8%

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

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

Developer target: 71.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{c}{a \cdot \frac{\left(-b\right) + t_0}{2 \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;\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)
     (/ c (* a (/ (+ (- b) t_0) (* 2.0 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 = c / (a * ((-b + t_0) / (2.0 * a)));
	} else {
		tmp = (-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 = c / (a * ((-b + t_0) / (2.0d0 * a)))
    else
        tmp = (-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 = c / (a * ((-b + t_0) / (2.0 * a)));
	} else {
		tmp = (-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 = c / (a * ((-b + t_0) / (2.0 * a)))
	else:
		tmp = (-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(c / Float64(a * Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a))));
	else
		tmp = 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 = c / (a * ((-b + t_0) / (2.0 * a)));
	else
		tmp = (-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[(c / N[(a * N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-b) - t$95$0), $MachinePrecision] / N[(2.0 * a), $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{c}{a \cdot \frac{\left(-b\right) + t_0}{2 \cdot a}}\\

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


\end{array}
\end{array}

Reproduce

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

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

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