The quadratic formula (r2)

Percentage Accurate: 51.9% → 85.8%
Time: 12.7s
Alternatives: 7
Speedup: 19.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 7 alternatives:

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

Initial Program: 51.9% accurate, 1.0× speedup?

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

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

Alternative 1: 85.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 14.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.6e-53 < b < 1.12e78

    1. Initial program 75.7%

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

    if 1.12e78 < b

    1. Initial program 62.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 80.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 15.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.2999999999999998e-80 < b < 4.10000000000000002e-47

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}\right) \cdot \frac{1}{a \cdot -2}} \]
    6. Taylor expanded in b around 0 69.4%

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

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

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

      \[\leadsto \left(b + \sqrt{\color{blue}{a \cdot \left(c \cdot -4\right)}}\right) \cdot \frac{1}{a \cdot -2} \]
    9. Step-by-step derivation
      1. add-log-exp6.1%

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

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

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

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

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

        \[\leadsto \log \left({\left(e^{\frac{1}{a \cdot \color{blue}{\frac{1}{-0.5}}}}\right)}^{\left(b + \sqrt{a \cdot \left(c \cdot -4\right)}\right)}\right) \]
      7. div-inv3.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(b + \sqrt{a \cdot \left(c \cdot -4\right)}\right)} \cdot \log \left(e^{\frac{-0.5}{a}}\right) \]
      3. rem-log-exp69.4%

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

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

    if 4.10000000000000002e-47 < b

    1. Initial program 70.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 80.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 15.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.79999999999999996e-80 < b < 1.65000000000000002e-47

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}\right) \cdot \frac{1}{a \cdot -2}} \]
    6. Taylor expanded in b around 0 69.4%

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

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

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

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

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

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

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

    if 1.65000000000000002e-47 < b

    1. Initial program 70.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 68.1% accurate, 12.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\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 < -4.999999999999985e-310

    1. Initial program 31.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 72.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 43.3% accurate, 19.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -3 \cdot 10^{+74}:\\
\;\;\;\;\frac{c}{b}\\

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


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

    1. Initial program 11.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c}{a \cdot -2} \cdot \frac{a \cdot -2}{b}} \]
      3. associate-*l/40.1%

        \[\leadsto \color{blue}{\frac{c \cdot \frac{a \cdot -2}{b}}{a \cdot -2}} \]
      4. associate-*r/39.8%

        \[\leadsto \frac{\color{blue}{\frac{c \cdot \left(a \cdot -2\right)}{b}}}{a \cdot -2} \]
      5. *-commutative39.8%

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

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

        \[\leadsto \color{blue}{\frac{a \cdot -2}{a \cdot -2} \cdot \frac{c}{b}} \]
      8. *-inverses39.9%

        \[\leadsto \color{blue}{1} \cdot \frac{c}{b} \]
      9. *-lft-identity39.9%

        \[\leadsto \color{blue}{\frac{c}{b}} \]
    10. Simplified39.9%

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

    if -3e74 < b

    1. Initial program 63.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 67.9% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 31.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999999e-305 < b

    1. Initial program 72.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 11.0% accurate, 38.7× speedup?

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

\\
\frac{c}{b}
\end{array}
Derivation
  1. Initial program 50.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{c}{a \cdot -2} \cdot \frac{a \cdot -2}{b}} \]
    3. associate-*l/12.4%

      \[\leadsto \color{blue}{\frac{c \cdot \frac{a \cdot -2}{b}}{a \cdot -2}} \]
    4. associate-*r/12.3%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{c}{b}} \]
  10. Simplified12.4%

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  11. Final simplification12.4%

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

Developer target: 70.7% 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 2023309 
(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)))