quadm (p42, negative)

Percentage Accurate: 53.2% → 90.5%
Time: 12.2s
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.2% 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: 90.5% 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 -1.1 \cdot 10^{+130}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq -2.5 \cdot 10^{-297}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b - t_0}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{+65}:\\ \;\;\;\;-0.5 \cdot \frac{b + t_0}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \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 -1.1e+130)
     (/ (- c) b)
     (if (<= b -2.5e-297)
       (* -0.5 (/ (* c 4.0) (- b t_0)))
       (if (<= b 4e+65) (* -0.5 (/ (+ b t_0) a)) (- (/ c b) (/ b a)))))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - ((c * 4.0) * a)));
	double tmp;
	if (b <= -1.1e+130) {
		tmp = -c / b;
	} else if (b <= -2.5e-297) {
		tmp = -0.5 * ((c * 4.0) / (b - t_0));
	} else if (b <= 4e+65) {
		tmp = -0.5 * ((b + t_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) :: t_0
    real(8) :: tmp
    t_0 = sqrt(((b * b) - ((c * 4.0d0) * a)))
    if (b <= (-1.1d+130)) then
        tmp = -c / b
    else if (b <= (-2.5d-297)) then
        tmp = (-0.5d0) * ((c * 4.0d0) / (b - t_0))
    else if (b <= 4d+65) then
        tmp = (-0.5d0) * ((b + t_0) / a)
    else
        tmp = (c / b) - (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 <= -1.1e+130) {
		tmp = -c / b;
	} else if (b <= -2.5e-297) {
		tmp = -0.5 * ((c * 4.0) / (b - t_0));
	} else if (b <= 4e+65) {
		tmp = -0.5 * ((b + t_0) / a);
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt(((b * b) - ((c * 4.0) * a)))
	tmp = 0
	if b <= -1.1e+130:
		tmp = -c / b
	elif b <= -2.5e-297:
		tmp = -0.5 * ((c * 4.0) / (b - t_0))
	elif b <= 4e+65:
		tmp = -0.5 * ((b + t_0) / a)
	else:
		tmp = (c / b) - (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 <= -1.1e+130)
		tmp = Float64(Float64(-c) / b);
	elseif (b <= -2.5e-297)
		tmp = Float64(-0.5 * Float64(Float64(c * 4.0) / Float64(b - t_0)));
	elseif (b <= 4e+65)
		tmp = Float64(-0.5 * Float64(Float64(b + t_0) / a));
	else
		tmp = Float64(Float64(c / b) - 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 <= -1.1e+130)
		tmp = -c / b;
	elseif (b <= -2.5e-297)
		tmp = -0.5 * ((c * 4.0) / (b - t_0));
	elseif (b <= 4e+65)
		tmp = -0.5 * ((b + t_0) / a);
	else
		tmp = (c / b) - (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, -1.1e+130], N[((-c) / b), $MachinePrecision], If[LessEqual[b, -2.5e-297], N[(-0.5 * N[(N[(c * 4.0), $MachinePrecision] / N[(b - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4e+65], N[(-0.5 * N[(N[(b + t$95$0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

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

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


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

    1. Initial program 4.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 95.9%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified95.9%

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

    if -1.09999999999999997e130 < b < -2.5e-297

    1. Initial program 44.5%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified44.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-udef44.5%

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{\left(a \cdot c\right) \cdot -4} + b \cdot b}}{a} \]
      3. metadata-eval44.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-in44.5%

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\left(-\color{blue}{4 \cdot \left(a \cdot c\right)}\right) + b \cdot b}}{a} \]
      6. +-commutative44.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-neg44.5%

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

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b - \color{blue}{a \cdot \left(c \cdot 4\right)}}}{a} \]
    4. Applied egg-rr44.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-+44.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-sqrt44.5%

        \[\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-rr44.5%

      \[\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-78.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. +-inverses78.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. *-commutative78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{\left(a \cdot c\right) \cdot -4} + b \cdot b}}{a} \]
      3. metadata-eval44.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-in44.5%

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\left(-\color{blue}{4 \cdot \left(a \cdot c\right)}\right) + b \cdot b}}{a} \]
      6. +-commutative44.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-neg44.5%

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

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

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

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

    if -2.5e-297 < b < 4e65

    1. Initial program 87.9%

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

      \[\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-udef87.9%

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

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

        \[\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-in87.9%

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

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

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

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

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

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

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

    if 4e65 < b

    1. Initial program 54.8%

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

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

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

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

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

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

Alternative 2: 85.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 18.5%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified18.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-udef18.5%

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{\left(a \cdot c\right) \cdot -4} + b \cdot b}}{a} \]
      3. metadata-eval18.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-in18.5%

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\left(-\color{blue}{4 \cdot \left(a \cdot c\right)}\right) + b \cdot b}}{a} \]
      6. +-commutative18.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-neg18.5%

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

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b - \color{blue}{a \cdot \left(c \cdot 4\right)}}}{a} \]
    4. Applied egg-rr18.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-+17.8%

        \[\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.8%

        \[\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.8%

      \[\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.3%

        \[\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.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. *-commutative65.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.4999999999999997e-95 < b < 7.39999999999999996e68

    1. Initial program 85.0%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified85.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-udef85.0%

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{\left(a \cdot c\right) \cdot -4} + b \cdot b}}{a} \]
      3. metadata-eval85.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-in85.0%

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\left(-\color{blue}{4 \cdot \left(a \cdot c\right)}\right) + b \cdot b}}{a} \]
      6. +-commutative85.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-neg85.0%

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

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

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

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

    if 7.39999999999999996e68 < b

    1. Initial program 54.8%

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

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

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

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

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

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

Alternative 3: 79.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -3.4 \cdot 10^{-94}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b + \left(b - \frac{c}{\frac{b}{a}} \cdot 2\right)}\\ \mathbf{elif}\;b \leq 2.05 \cdot 10^{+20}:\\ \;\;\;\;-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 -3.4e-94)
   (* -0.5 (/ (* c 4.0) (+ b (- b (* (/ c (/ b a)) 2.0)))))
   (if (<= b 2.05e+20)
     (* -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 <= -3.4e-94) {
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))));
	} else if (b <= 2.05e+20) {
		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 <= (-3.4d-94)) then
        tmp = (-0.5d0) * ((c * 4.0d0) / (b + (b - ((c / (b / a)) * 2.0d0))))
    else if (b <= 2.05d+20) 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 <= -3.4e-94) {
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))));
	} else if (b <= 2.05e+20) {
		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 <= -3.4e-94:
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))))
	elif b <= 2.05e+20:
		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 <= -3.4e-94)
		tmp = Float64(-0.5 * Float64(Float64(c * 4.0) / Float64(b + Float64(b - Float64(Float64(c / Float64(b / a)) * 2.0)))));
	elseif (b <= 2.05e+20)
		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 <= -3.4e-94)
		tmp = -0.5 * ((c * 4.0) / (b + (b - ((c / (b / a)) * 2.0))));
	elseif (b <= 2.05e+20)
		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, -3.4e-94], 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.05e+20], 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 -3.4 \cdot 10^{-94}:\\
\;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b + \left(b - \frac{c}{\frac{b}{a}} \cdot 2\right)}\\

\mathbf{elif}\;b \leq 2.05 \cdot 10^{+20}:\\
\;\;\;\;-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 < -3.3999999999999998e-94

    1. Initial program 18.5%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified18.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-udef18.5%

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{\left(a \cdot c\right) \cdot -4} + b \cdot b}}{a} \]
      3. metadata-eval18.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-in18.5%

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\left(-\color{blue}{4 \cdot \left(a \cdot c\right)}\right) + b \cdot b}}{a} \]
      6. +-commutative18.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-neg18.5%

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

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b - \color{blue}{a \cdot \left(c \cdot 4\right)}}}{a} \]
    4. Applied egg-rr18.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-+17.8%

        \[\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.8%

        \[\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.8%

      \[\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.3%

        \[\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.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. *-commutative65.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.3999999999999998e-94 < b < 2.05e20

    1. Initial program 83.0%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified83.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 67.5%

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

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

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

    if 2.05e20 < b

    1. Initial program 62.8%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.4 \cdot 10^{-94}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b + \left(b - \frac{c}{\frac{b}{a}} \cdot 2\right)}\\ \mathbf{elif}\;b \leq 2.05 \cdot 10^{+20}:\\ \;\;\;\;-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 4: 67.5% accurate, 6.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.16 \cdot 10^{-296}:\\ \;\;\;\;-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 2.16e-296)
   (* -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 <= 2.16e-296) {
		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 <= 2.16d-296) 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 <= 2.16e-296) {
		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 <= 2.16e-296:
		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 <= 2.16e-296)
		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 <= 2.16e-296)
		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, 2.16e-296], 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 2.16 \cdot 10^{-296}:\\
\;\;\;\;-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 < 2.1600000000000001e-296

    1. Initial program 31.0%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified31.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-udef31.0%

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\color{blue}{\left(a \cdot c\right) \cdot -4} + b \cdot b}}{a} \]
      3. metadata-eval31.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-in31.0%

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{\left(-\color{blue}{4 \cdot \left(a \cdot c\right)}\right) + b \cdot b}}{a} \]
      6. +-commutative31.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-neg31.0%

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

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

        \[\leadsto -0.5 \cdot \frac{b + \sqrt{b \cdot b - \color{blue}{a \cdot \left(c \cdot 4\right)}}}{a} \]
    4. Applied egg-rr31.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-+30.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-sqrt30.5%

        \[\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-rr30.5%

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

        \[\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. +-inverses67.5%

        \[\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. *-commutative67.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.1600000000000001e-296 < b

    1. Initial program 74.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 67.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 2.16 \cdot 10^{-296}:\\ \;\;\;\;-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 5: 67.4% 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 30.5%

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 74.6%

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

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

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

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

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

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

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

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

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


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

    1. Initial program 12.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. clear-num12.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.49999999999999999e90 < b

    1. Initial program 65.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 44.1%

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

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

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

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

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

Alternative 7: 67.3% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 29.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 71.3%

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

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

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

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

    if -1.03999999999999999e-303 < b

    1. Initial program 74.8%

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

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

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

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

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

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

Alternative 8: 2.6% accurate, 38.7× speedup?

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

\\
\frac{b}{a}
\end{array}
Derivation
  1. Initial program 52.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. clear-num51.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 10.8% 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 52.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. clear-num51.9%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  5. Final simplification11.1%

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

Developer target: 71.0% 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 2023222 
(FPCore (a b c)
  :name "quadm (p42, negative)"
  :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)))