quadm (p42, negative)

Percentage Accurate: 52.9% → 84.9%
Time: 16.8s
Alternatives: 10
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 10 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: 52.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: 84.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -4.6 \cdot 10^{-15}:\\ \;\;\;\;\frac{-0.5}{-0.5 \cdot \frac{a}{b} + 0.5 \cdot \frac{b}{c}}\\ \mathbf{elif}\;b \leq 2.35 \cdot 10^{+67}:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -4.6e-15)
   (/ -0.5 (+ (* -0.5 (/ a b)) (* 0.5 (/ b c))))
   (if (<= b 2.35e+67)
     (* -0.5 (/ (+ b (sqrt (fma a (* c -4.0) (* b b)))) a))
     (- (/ c b) (/ b a)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -4.6e-15) {
		tmp = -0.5 / ((-0.5 * (a / b)) + (0.5 * (b / c)));
	} else if (b <= 2.35e+67) {
		tmp = -0.5 * ((b + sqrt(fma(a, (c * -4.0), (b * b)))) / a);
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -4.6e-15)
		tmp = Float64(-0.5 / Float64(Float64(-0.5 * Float64(a / b)) + Float64(0.5 * Float64(b / c))));
	elseif (b <= 2.35e+67)
		tmp = Float64(-0.5 * Float64(Float64(b + sqrt(fma(a, Float64(c * -4.0), Float64(b * b)))) / a));
	else
		tmp = Float64(Float64(c / b) - Float64(b / a));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -4.6e-15], N[(-0.5 / N[(N[(-0.5 * N[(a / b), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.35e+67], N[(-0.5 * N[(N[(b + N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision] + N[(b * b), $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 -4.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{-0.5}{-0.5 \cdot \frac{a}{b} + 0.5 \cdot \frac{b}{c}}\\

\mathbf{elif}\;b \leq 2.35 \cdot 10^{+67}:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a}\\

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


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

    1. Initial program 11.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. sub-neg11.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.59999999999999981e-15 < b < 2.35000000000000009e67

    1. Initial program 76.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. sub-neg76.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.35000000000000009e67 < b

    1. Initial program 66.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. sub-neg66.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.6 \cdot 10^{-15}:\\ \;\;\;\;\frac{-0.5}{-0.5 \cdot \frac{a}{b} + 0.5 \cdot \frac{b}{c}}\\ \mathbf{elif}\;b \leq 2.35 \cdot 10^{+67}:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \]

Alternative 2: 84.9% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 3 \cdot 10^{+67}:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\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 < -4.59999999999999981e-15

    1. Initial program 11.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. sub-neg11.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.59999999999999981e-15 < b < 3.0000000000000001e67

    1. Initial program 76.9%

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

    if 3.0000000000000001e67 < b

    1. Initial program 66.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. sub-neg66.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 84.9% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 3.8 \cdot 10^{+67}:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \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 < -4.59999999999999981e-15

    1. Initial program 11.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. sub-neg11.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.59999999999999981e-15 < b < 3.8000000000000002e67

    1. Initial program 76.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. *-commutative76.9%

        \[\leadsto \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \color{blue}{\left(c \cdot a\right)}}}{2 \cdot a} \]
      2. sqr-neg76.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. *-commutative76.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-neg76.9%

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

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

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

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

    if 3.8000000000000002e67 < b

    1. Initial program 66.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. sub-neg66.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 80.5% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 11.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. sub-neg11.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.59999999999999981e-15 < b < 7.99999999999999966e-103

    1. Initial program 72.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. sub-neg72.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\left(\frac{1}{a} \cdot \left(b + {\left({\left(\left(a \cdot -4\right) \cdot c\right)}^{0.25}\right)}^{2}\right)\right)} \]
      3. pow-pow67.8%

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

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

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

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

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

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

    if 7.99999999999999966e-103 < 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. sub-neg72.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 80.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -4.6 \cdot 10^{-15}:\\ \;\;\;\;\frac{-0.5}{-0.5 \cdot \frac{a}{b} + 0.5 \cdot \frac{b}{c}}\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{-103}:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -4\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -4.6e-15)
   (/ -0.5 (+ (* -0.5 (/ a b)) (* 0.5 (/ b c))))
   (if (<= b 7.2e-103)
     (* -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 <= -4.6e-15) {
		tmp = -0.5 / ((-0.5 * (a / b)) + (0.5 * (b / c)));
	} else if (b <= 7.2e-103) {
		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 <= (-4.6d-15)) then
        tmp = (-0.5d0) / (((-0.5d0) * (a / b)) + (0.5d0 * (b / c)))
    else if (b <= 7.2d-103) 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 <= -4.6e-15) {
		tmp = -0.5 / ((-0.5 * (a / b)) + (0.5 * (b / c)));
	} else if (b <= 7.2e-103) {
		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 <= -4.6e-15:
		tmp = -0.5 / ((-0.5 * (a / b)) + (0.5 * (b / c)))
	elif b <= 7.2e-103:
		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 <= -4.6e-15)
		tmp = Float64(-0.5 / Float64(Float64(-0.5 * Float64(a / b)) + Float64(0.5 * Float64(b / c))));
	elseif (b <= 7.2e-103)
		tmp = Float64(-0.5 * Float64(Float64(b + sqrt(Float64(c * Float64(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 <= -4.6e-15)
		tmp = -0.5 / ((-0.5 * (a / b)) + (0.5 * (b / c)));
	elseif (b <= 7.2e-103)
		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, -4.6e-15], N[(-0.5 / N[(N[(-0.5 * N[(a / b), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.2e-103], N[(-0.5 * N[(N[(b + N[Sqrt[N[(c * N[(a * -4.0), $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 -4.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{-0.5}{-0.5 \cdot \frac{a}{b} + 0.5 \cdot \frac{b}{c}}\\

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

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


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

    1. Initial program 11.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. sub-neg11.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.59999999999999981e-15 < b < 7.1999999999999996e-103

    1. Initial program 72.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. sub-neg72.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \frac{b + {\color{blue}{\left({\left(\left(a \cdot -4\right) \cdot c\right)}^{0.25}\right)}}^{2}}{a} \]
    9. Taylor expanded in a around 0 40.1%

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

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

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

        \[\leadsto -0.5 \cdot \frac{b + {\left(e^{\color{blue}{\log \left({\left(a \cdot \left(c \cdot -4\right)\right)}^{0.25}\right)}}\right)}^{2}}{a} \]
      4. rem-exp-log67.7%

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

        \[\leadsto -0.5 \cdot \frac{b + \color{blue}{{\left(a \cdot \left(c \cdot -4\right)\right)}^{0.25} \cdot {\left(a \cdot \left(c \cdot -4\right)\right)}^{0.25}}}{a} \]
      6. pow-sqr67.8%

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

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

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

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

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

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

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

    if 7.1999999999999996e-103 < 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. sub-neg72.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 80.2% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 11.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. sub-neg11.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.59999999999999981e-15 < b < 2.49999999999999983e-103

    1. Initial program 72.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. sub-neg72.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \frac{b + {\color{blue}{\left({\left(\left(a \cdot -4\right) \cdot c\right)}^{0.25}\right)}}^{2}}{a} \]
    9. Taylor expanded in c around 0 34.2%

      \[\leadsto -0.5 \cdot \frac{b + {\color{blue}{\left(e^{0.25 \cdot \left(\log c + \log \left(-4 \cdot a\right)\right)}\right)}}^{2}}{a} \]
    10. Taylor expanded in b around 0 34.3%

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

        \[\leadsto -0.5 \cdot \frac{{\left(e^{\color{blue}{\left(\log c + \log \left(-4 \cdot a\right)\right) \cdot 0.25}}\right)}^{2}}{a} \]
      2. *-commutative34.3%

        \[\leadsto -0.5 \cdot \frac{{\left(e^{\left(\log c + \log \color{blue}{\left(a \cdot -4\right)}\right) \cdot 0.25}\right)}^{2}}{a} \]
      3. log-prod62.8%

        \[\leadsto -0.5 \cdot \frac{{\left(e^{\color{blue}{\log \left(c \cdot \left(a \cdot -4\right)\right)} \cdot 0.25}\right)}^{2}}{a} \]
      4. exp-to-pow67.2%

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

        \[\leadsto -0.5 \cdot \frac{\color{blue}{{\left(c \cdot \left(a \cdot -4\right)\right)}^{0.25} \cdot {\left(c \cdot \left(a \cdot -4\right)\right)}^{0.25}}}{a} \]
      6. pow-sqr67.3%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{{\left(c \cdot \left(a \cdot -4\right)\right)}^{\left(2 \cdot 0.25\right)}}}{a} \]
      7. metadata-eval67.3%

        \[\leadsto -0.5 \cdot \frac{{\left(c \cdot \left(a \cdot -4\right)\right)}^{\color{blue}{0.5}}}{a} \]
      8. unpow1/267.3%

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

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

        \[\leadsto -0.5 \cdot \frac{\sqrt{\color{blue}{\left(a \cdot c\right)} \cdot -4}}{a} \]
      11. rem-square-sqrt0.0%

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

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

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

        \[\leadsto -0.5 \cdot \frac{\sqrt{a \cdot \left(c \cdot \color{blue}{\left(\sqrt{-4} \cdot \sqrt{-4}\right)}\right)}}{a} \]
      15. rem-square-sqrt67.3%

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

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

    if 2.49999999999999983e-103 < 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. sub-neg72.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 67.1% accurate, 7.7× speedup?

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

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

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


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

    1. Initial program 30.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. sub-neg30.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.90000000000000016e-279 < b

    1. Initial program 74.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. sub-neg74.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 67.4% accurate, 12.8× speedup?

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

    1. Initial program 29.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. sub-neg29.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < b

    1. Initial program 73.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. sub-neg73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 67.2% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 29.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. sub-neg29.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < b

    1. Initial program 73.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. sub-neg73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 34.4% accurate, 29.0× 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(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. sub-neg52.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\frac{c}{b}} \]
  6. Simplified37.0%

    \[\leadsto \color{blue}{-\frac{c}{b}} \]
  7. Final simplification37.0%

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

Developer target: 99.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|\frac{b}{2}\right|\\ t_1 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\ t_2 := \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\ \;\;\;\;\sqrt{t_0 - t_1} \cdot \sqrt{t_0 + t_1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{hypot}\left(\frac{b}{2}, t_1\right)\\ \end{array}\\ \mathbf{if}\;b < 0:\\ \;\;\;\;\frac{c}{t_2 - \frac{b}{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b}{2} + t_2}{-a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fabs (/ b 2.0)))
        (t_1 (* (sqrt (fabs a)) (sqrt (fabs c))))
        (t_2
         (if (== (copysign a c) a)
           (* (sqrt (- t_0 t_1)) (sqrt (+ t_0 t_1)))
           (hypot (/ b 2.0) t_1))))
   (if (< b 0.0) (/ c (- t_2 (/ b 2.0))) (/ (+ (/ b 2.0) t_2) (- a)))))
double code(double a, double b, double c) {
	double t_0 = fabs((b / 2.0));
	double t_1 = sqrt(fabs(a)) * sqrt(fabs(c));
	double tmp;
	if (copysign(a, c) == a) {
		tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1));
	} else {
		tmp = hypot((b / 2.0), t_1);
	}
	double t_2 = tmp;
	double tmp_1;
	if (b < 0.0) {
		tmp_1 = c / (t_2 - (b / 2.0));
	} else {
		tmp_1 = ((b / 2.0) + t_2) / -a;
	}
	return tmp_1;
}
public static double code(double a, double b, double c) {
	double t_0 = Math.abs((b / 2.0));
	double t_1 = Math.sqrt(Math.abs(a)) * Math.sqrt(Math.abs(c));
	double tmp;
	if (Math.copySign(a, c) == a) {
		tmp = Math.sqrt((t_0 - t_1)) * Math.sqrt((t_0 + t_1));
	} else {
		tmp = Math.hypot((b / 2.0), t_1);
	}
	double t_2 = tmp;
	double tmp_1;
	if (b < 0.0) {
		tmp_1 = c / (t_2 - (b / 2.0));
	} else {
		tmp_1 = ((b / 2.0) + t_2) / -a;
	}
	return tmp_1;
}
def code(a, b, c):
	t_0 = math.fabs((b / 2.0))
	t_1 = math.sqrt(math.fabs(a)) * math.sqrt(math.fabs(c))
	tmp = 0
	if math.copysign(a, c) == a:
		tmp = math.sqrt((t_0 - t_1)) * math.sqrt((t_0 + t_1))
	else:
		tmp = math.hypot((b / 2.0), t_1)
	t_2 = tmp
	tmp_1 = 0
	if b < 0.0:
		tmp_1 = c / (t_2 - (b / 2.0))
	else:
		tmp_1 = ((b / 2.0) + t_2) / -a
	return tmp_1
function code(a, b, c)
	t_0 = abs(Float64(b / 2.0))
	t_1 = Float64(sqrt(abs(a)) * sqrt(abs(c)))
	tmp = 0.0
	if (copysign(a, c) == a)
		tmp = Float64(sqrt(Float64(t_0 - t_1)) * sqrt(Float64(t_0 + t_1)));
	else
		tmp = hypot(Float64(b / 2.0), t_1);
	end
	t_2 = tmp
	tmp_1 = 0.0
	if (b < 0.0)
		tmp_1 = Float64(c / Float64(t_2 - Float64(b / 2.0)));
	else
		tmp_1 = Float64(Float64(Float64(b / 2.0) + t_2) / Float64(-a));
	end
	return tmp_1
end
function tmp_3 = code(a, b, c)
	t_0 = abs((b / 2.0));
	t_1 = sqrt(abs(a)) * sqrt(abs(c));
	tmp = 0.0;
	if ((sign(c) * abs(a)) == a)
		tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1));
	else
		tmp = hypot((b / 2.0), t_1);
	end
	t_2 = tmp;
	tmp_2 = 0.0;
	if (b < 0.0)
		tmp_2 = c / (t_2 - (b / 2.0));
	else
		tmp_2 = ((b / 2.0) + t_2) / -a;
	end
	tmp_3 = tmp_2;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Abs[N[(b / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[Abs[a], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Abs[c], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = If[Equal[N[With[{TMP1 = Abs[a], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], a], N[(N[Sqrt[N[(t$95$0 - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$0 + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(b / 2.0), $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]]}, If[Less[b, 0.0], N[(c / N[(t$95$2 - N[(b / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b / 2.0), $MachinePrecision] + t$95$2), $MachinePrecision] / (-a)), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left|\frac{b}{2}\right|\\
t_1 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\
t_2 := \begin{array}{l}
\mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\
\;\;\;\;\sqrt{t_0 - t_1} \cdot \sqrt{t_0 + t_1}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(\frac{b}{2}, t_1\right)\\


\end{array}\\
\mathbf{if}\;b < 0:\\
\;\;\;\;\frac{c}{t_2 - \frac{b}{2}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{b}{2} + t_2}{-a}\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023339 
(FPCore (a b c)
  :name "quadm (p42, negative)"
  :precision binary64
  :herbie-expected 10

  :herbie-target
  (if (< b 0.0) (/ c (- (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot (/ b 2.0) (* (sqrt (fabs a)) (sqrt (fabs c))))) (/ b 2.0))) (/ (+ (/ b 2.0) (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot (/ b 2.0) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (- a)))

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