The quadratic formula (r1)

Percentage Accurate: 53.8% → 85.1%
Time: 19.3s
Alternatives: 11
Speedup: 19.1×

Specification

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

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{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 11 alternatives:

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

Initial Program: 53.8% accurate, 1.0× speedup?

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

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

Alternative 1: 85.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+153}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq -3.8 \cdot 10^{-20}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq -2.55 \cdot 10^{-48}:\\ \;\;\;\;\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot -4} \cdot \sqrt{a}\right)\right) \cdot \frac{-0.5}{a}\\ \mathbf{elif}\;b \leq 5.2 \cdot 10^{-70}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1e+153)
   (/ (- b) a)
   (if (<= b -3.8e-20)
     (/ (- (sqrt (- (* b b) (* 4.0 (* a c)))) b) (* a 2.0))
     (if (<= b -2.55e-48)
       (* (- b (hypot b (* (sqrt (* c -4.0)) (sqrt a)))) (/ -0.5 a))
       (if (<= b 5.2e-70)
         (* (/ -0.5 a) (- b (hypot b (sqrt (* a (* c -4.0))))))
         (/ (- c) b))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e+153) {
		tmp = -b / a;
	} else if (b <= -3.8e-20) {
		tmp = (sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	} else if (b <= -2.55e-48) {
		tmp = (b - hypot(b, (sqrt((c * -4.0)) * sqrt(a)))) * (-0.5 / a);
	} else if (b <= 5.2e-70) {
		tmp = (-0.5 / a) * (b - hypot(b, sqrt((a * (c * -4.0)))));
	} else {
		tmp = -c / b;
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e+153) {
		tmp = -b / a;
	} else if (b <= -3.8e-20) {
		tmp = (Math.sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	} else if (b <= -2.55e-48) {
		tmp = (b - Math.hypot(b, (Math.sqrt((c * -4.0)) * Math.sqrt(a)))) * (-0.5 / a);
	} else if (b <= 5.2e-70) {
		tmp = (-0.5 / a) * (b - Math.hypot(b, Math.sqrt((a * (c * -4.0)))));
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1e+153:
		tmp = -b / a
	elif b <= -3.8e-20:
		tmp = (math.sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0)
	elif b <= -2.55e-48:
		tmp = (b - math.hypot(b, (math.sqrt((c * -4.0)) * math.sqrt(a)))) * (-0.5 / a)
	elif b <= 5.2e-70:
		tmp = (-0.5 / a) * (b - math.hypot(b, math.sqrt((a * (c * -4.0)))))
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1e+153)
		tmp = Float64(Float64(-b) / a);
	elseif (b <= -3.8e-20)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c)))) - b) / Float64(a * 2.0));
	elseif (b <= -2.55e-48)
		tmp = Float64(Float64(b - hypot(b, Float64(sqrt(Float64(c * -4.0)) * sqrt(a)))) * Float64(-0.5 / a));
	elseif (b <= 5.2e-70)
		tmp = Float64(Float64(-0.5 / a) * Float64(b - hypot(b, sqrt(Float64(a * Float64(c * -4.0))))));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1e+153)
		tmp = -b / a;
	elseif (b <= -3.8e-20)
		tmp = (sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	elseif (b <= -2.55e-48)
		tmp = (b - hypot(b, (sqrt((c * -4.0)) * sqrt(a)))) * (-0.5 / a);
	elseif (b <= 5.2e-70)
		tmp = (-0.5 / a) * (b - hypot(b, sqrt((a * (c * -4.0)))));
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1e+153], N[((-b) / a), $MachinePrecision], If[LessEqual[b, -3.8e-20], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -2.55e-48], N[(N[(b - N[Sqrt[b ^ 2 + N[(N[Sqrt[N[(c * -4.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[a], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.2e-70], N[(N[(-0.5 / a), $MachinePrecision] * N[(b - N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;b \leq -2.55 \cdot 10^{-48}:\\
\;\;\;\;\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot -4} \cdot \sqrt{a}\right)\right) \cdot \frac{-0.5}{a}\\

\mathbf{elif}\;b \leq 5.2 \cdot 10^{-70}:\\
\;\;\;\;\frac{-0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)\\

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


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

    1. Initial program 38.1%

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

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

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

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

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

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

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

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

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

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

    if -1e153 < b < -3.7999999999999998e-20

    1. Initial program 97.1%

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

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

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

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

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

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

    if -3.7999999999999998e-20 < b < -2.55000000000000006e-48

    1. Initial program 35.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(b - \mathsf{hypot}\left(b, \color{blue}{\sqrt{c \cdot -4} \cdot \sqrt{a}}\right)\right) \cdot \frac{-0.5}{a} \]
    9. Applied egg-rr99.5%

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

    if -2.55000000000000006e-48 < b < 5.20000000000000004e-70

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{\left(-4 \cdot c\right) \cdot a}\right)\right) \cdot \frac{1}{a \cdot -2}} \]
    6. Step-by-step derivation
      1. *-commutative80.9%

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

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

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

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

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

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

    if 5.20000000000000004e-70 < b

    1. Initial program 13.2%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+153}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq -3.8 \cdot 10^{-20}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq -2.55 \cdot 10^{-48}:\\ \;\;\;\;\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot -4} \cdot \sqrt{a}\right)\right) \cdot \frac{-0.5}{a}\\ \mathbf{elif}\;b \leq 5.2 \cdot 10^{-70}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 2: 85.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+154}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq -8.6 \cdot 10^{-44}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq -2.55 \cdot 10^{-48}:\\ \;\;\;\;\frac{1}{a \cdot 2} \cdot \mathsf{fma}\left(\sqrt{a}, \sqrt{c \cdot -4}, b\right)\\ \mathbf{elif}\;b \leq 3.7 \cdot 10^{-70}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -5e+154)
   (/ (- b) a)
   (if (<= b -8.6e-44)
     (/ (- (sqrt (- (* b b) (* 4.0 (* a c)))) b) (* a 2.0))
     (if (<= b -2.55e-48)
       (* (/ 1.0 (* a 2.0)) (fma (sqrt a) (sqrt (* c -4.0)) b))
       (if (<= b 3.7e-70)
         (* (/ -0.5 a) (- b (hypot b (sqrt (* a (* c -4.0))))))
         (/ (- c) b))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5e+154) {
		tmp = -b / a;
	} else if (b <= -8.6e-44) {
		tmp = (sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	} else if (b <= -2.55e-48) {
		tmp = (1.0 / (a * 2.0)) * fma(sqrt(a), sqrt((c * -4.0)), b);
	} else if (b <= 3.7e-70) {
		tmp = (-0.5 / a) * (b - hypot(b, sqrt((a * (c * -4.0)))));
	} else {
		tmp = -c / b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -5e+154)
		tmp = Float64(Float64(-b) / a);
	elseif (b <= -8.6e-44)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c)))) - b) / Float64(a * 2.0));
	elseif (b <= -2.55e-48)
		tmp = Float64(Float64(1.0 / Float64(a * 2.0)) * fma(sqrt(a), sqrt(Float64(c * -4.0)), b));
	elseif (b <= 3.7e-70)
		tmp = Float64(Float64(-0.5 / a) * Float64(b - hypot(b, sqrt(Float64(a * Float64(c * -4.0))))));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -5e+154], N[((-b) / a), $MachinePrecision], If[LessEqual[b, -8.6e-44], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -2.55e-48], N[(N[(1.0 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[a], $MachinePrecision] * N[Sqrt[N[(c * -4.0), $MachinePrecision]], $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.7e-70], N[(N[(-0.5 / a), $MachinePrecision] * N[(b - N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;b \leq 3.7 \cdot 10^{-70}:\\
\;\;\;\;\frac{-0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if b < -5.00000000000000004e154

    1. Initial program 38.1%

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000000004e154 < b < -8.60000000000000027e-44

    1. Initial program 97.2%

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

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

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

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

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

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

    if -8.60000000000000027e-44 < b < -2.55000000000000006e-48

    1. Initial program 3.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.55000000000000006e-48 < b < 3.7e-70

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{\left(-4 \cdot c\right) \cdot a}\right)\right) \cdot \frac{1}{a \cdot -2}} \]
    6. Step-by-step derivation
      1. *-commutative80.9%

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

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

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

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

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

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

    if 3.7e-70 < b

    1. Initial program 13.2%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+154}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq -8.6 \cdot 10^{-44}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq -2.55 \cdot 10^{-48}:\\ \;\;\;\;\frac{1}{a \cdot 2} \cdot \mathsf{fma}\left(\sqrt{a}, \sqrt{c \cdot -4}, b\right)\\ \mathbf{elif}\;b \leq 3.7 \cdot 10^{-70}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 3: 85.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+154}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq -8.6 \cdot 10^{-44}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq -2.55 \cdot 10^{-48}:\\ \;\;\;\;\frac{\sqrt{c \cdot -4} \cdot \sqrt{a} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq 9 \cdot 10^{-70}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -5e+154)
   (/ (- b) a)
   (if (<= b -8.6e-44)
     (/ (- (sqrt (- (* b b) (* 4.0 (* a c)))) b) (* a 2.0))
     (if (<= b -2.55e-48)
       (/ (- (* (sqrt (* c -4.0)) (sqrt a)) b) (* a 2.0))
       (if (<= b 9e-70)
         (* (/ -0.5 a) (- b (hypot b (sqrt (* a (* c -4.0))))))
         (/ (- c) b))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5e+154) {
		tmp = -b / a;
	} else if (b <= -8.6e-44) {
		tmp = (sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	} else if (b <= -2.55e-48) {
		tmp = ((sqrt((c * -4.0)) * sqrt(a)) - b) / (a * 2.0);
	} else if (b <= 9e-70) {
		tmp = (-0.5 / a) * (b - hypot(b, sqrt((a * (c * -4.0)))));
	} else {
		tmp = -c / b;
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -5e+154) {
		tmp = -b / a;
	} else if (b <= -8.6e-44) {
		tmp = (Math.sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	} else if (b <= -2.55e-48) {
		tmp = ((Math.sqrt((c * -4.0)) * Math.sqrt(a)) - b) / (a * 2.0);
	} else if (b <= 9e-70) {
		tmp = (-0.5 / a) * (b - Math.hypot(b, Math.sqrt((a * (c * -4.0)))));
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -5e+154:
		tmp = -b / a
	elif b <= -8.6e-44:
		tmp = (math.sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0)
	elif b <= -2.55e-48:
		tmp = ((math.sqrt((c * -4.0)) * math.sqrt(a)) - b) / (a * 2.0)
	elif b <= 9e-70:
		tmp = (-0.5 / a) * (b - math.hypot(b, math.sqrt((a * (c * -4.0)))))
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -5e+154)
		tmp = Float64(Float64(-b) / a);
	elseif (b <= -8.6e-44)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c)))) - b) / Float64(a * 2.0));
	elseif (b <= -2.55e-48)
		tmp = Float64(Float64(Float64(sqrt(Float64(c * -4.0)) * sqrt(a)) - b) / Float64(a * 2.0));
	elseif (b <= 9e-70)
		tmp = Float64(Float64(-0.5 / a) * Float64(b - hypot(b, sqrt(Float64(a * Float64(c * -4.0))))));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -5e+154)
		tmp = -b / a;
	elseif (b <= -8.6e-44)
		tmp = (sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	elseif (b <= -2.55e-48)
		tmp = ((sqrt((c * -4.0)) * sqrt(a)) - b) / (a * 2.0);
	elseif (b <= 9e-70)
		tmp = (-0.5 / a) * (b - hypot(b, sqrt((a * (c * -4.0)))));
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -5e+154], N[((-b) / a), $MachinePrecision], If[LessEqual[b, -8.6e-44], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -2.55e-48], N[(N[(N[(N[Sqrt[N[(c * -4.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[a], $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9e-70], N[(N[(-0.5 / a), $MachinePrecision] * N[(b - N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;b \leq -2.55 \cdot 10^{-48}:\\
\;\;\;\;\frac{\sqrt{c \cdot -4} \cdot \sqrt{a} - b}{a \cdot 2}\\

\mathbf{elif}\;b \leq 9 \cdot 10^{-70}:\\
\;\;\;\;\frac{-0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if b < -5.00000000000000004e154

    1. Initial program 38.1%

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000000004e154 < b < -8.60000000000000027e-44

    1. Initial program 97.2%

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

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

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

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

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

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

    if -8.60000000000000027e-44 < b < -2.55000000000000006e-48

    1. Initial program 3.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(b - \mathsf{hypot}\left(b, \color{blue}{\sqrt{c \cdot -4} \cdot \sqrt{a}}\right)\right) \cdot \frac{-0.5}{a} \]
    8. Applied egg-rr98.4%

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

    if -2.55000000000000006e-48 < b < 9.00000000000000044e-70

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{\left(-4 \cdot c\right) \cdot a}\right)\right) \cdot \frac{1}{a \cdot -2}} \]
    6. Step-by-step derivation
      1. *-commutative80.9%

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

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

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

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

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

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

    if 9.00000000000000044e-70 < b

    1. Initial program 13.2%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+154}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq -8.6 \cdot 10^{-44}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq -2.55 \cdot 10^{-48}:\\ \;\;\;\;\frac{\sqrt{c \cdot -4} \cdot \sqrt{a} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq 9 \cdot 10^{-70}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 4: 83.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -310000000000:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.2 \cdot 10^{-69}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -310000000000.0)
   (- (/ c b) (/ b a))
   (if (<= b 1.2e-69)
     (* (/ -0.5 a) (- b (hypot b (sqrt (* a (* c -4.0))))))
     (/ (- c) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -310000000000.0) {
		tmp = (c / b) - (b / a);
	} else if (b <= 1.2e-69) {
		tmp = (-0.5 / a) * (b - hypot(b, sqrt((a * (c * -4.0)))));
	} else {
		tmp = -c / b;
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -310000000000.0) {
		tmp = (c / b) - (b / a);
	} else if (b <= 1.2e-69) {
		tmp = (-0.5 / a) * (b - Math.hypot(b, Math.sqrt((a * (c * -4.0)))));
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -310000000000.0:
		tmp = (c / b) - (b / a)
	elif b <= 1.2e-69:
		tmp = (-0.5 / a) * (b - math.hypot(b, math.sqrt((a * (c * -4.0)))))
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -310000000000.0)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif (b <= 1.2e-69)
		tmp = Float64(Float64(-0.5 / a) * Float64(b - hypot(b, sqrt(Float64(a * Float64(c * -4.0))))));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -310000000000.0)
		tmp = (c / b) - (b / a);
	elseif (b <= 1.2e-69)
		tmp = (-0.5 / a) * (b - hypot(b, sqrt((a * (c * -4.0)))));
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -310000000000.0], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.2e-69], N[(N[(-0.5 / a), $MachinePrecision] * N[(b - N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 1.2 \cdot 10^{-69}:\\
\;\;\;\;\frac{-0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)\\

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


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

    1. Initial program 63.7%

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

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

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

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

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

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

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

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

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

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

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

    if -3.1e11 < b < 1.2000000000000001e-69

    1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.2000000000000001e-69 < b

    1. Initial program 13.2%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -310000000000:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.2 \cdot 10^{-69}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 5: 86.5% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 38.1%

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

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

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

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

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

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

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

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

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

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

    if -1e153 < b < 4.60000000000000001e-70

    1. Initial program 82.4%

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

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

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

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

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

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

    if 4.60000000000000001e-70 < b

    1. Initial program 13.2%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 80.5% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 64.6%

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

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

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

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

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

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

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

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

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

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

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

    if -6.00000000000000014e-74 < b < 3.39999999999999995e-70

    1. Initial program 76.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.39999999999999995e-70 < b

    1. Initial program 13.2%

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 80.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 64.6%

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

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

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

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

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

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

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

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

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

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

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

    if -2.79999999999999988e-74 < b < 6.0000000000000003e-70

    1. Initial program 76.9%

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

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

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

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

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

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

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

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

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

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

    if 6.0000000000000003e-70 < b

    1. Initial program 13.2%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.8 \cdot 10^{-74}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 6 \cdot 10^{-70}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 8: 67.4% accurate, 12.8× speedup?

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

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

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


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

    1. Initial program 69.5%

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 28.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 42.8% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 68.6%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    6. Simplified51.9%

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

    if 2.02e-13 < b

    1. Initial program 10.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 67.2% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 69.5%

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 28.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 10.5% accurate, 38.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Developer target: 71.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\ \mathbf{if}\;b < 0:\\ \;\;\;\;\frac{\left(-b\right) + t_0}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{a \cdot \frac{\left(-b\right) - t_0}{2 \cdot a}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c)))))
   (if (< b 0.0)
     (/ (+ (- b) t_0) (* 2.0 a))
     (/ c (* a (/ (- (- b) t_0) (* 2.0 a)))))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
	double tmp;
	if (b < 0.0) {
		tmp = (-b + t_0) / (2.0 * a);
	} else {
		tmp = c / (a * ((-b - t_0) / (2.0 * a)));
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt(((b * b) - ((4.0d0 * a) * c)))
    if (b < 0.0d0) then
        tmp = (-b + t_0) / (2.0d0 * a)
    else
        tmp = c / (a * ((-b - t_0) / (2.0d0 * a)))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt(((b * b) - ((4.0 * a) * c)));
	double tmp;
	if (b < 0.0) {
		tmp = (-b + t_0) / (2.0 * a);
	} else {
		tmp = c / (a * ((-b - t_0) / (2.0 * a)));
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt(((b * b) - ((4.0 * a) * c)))
	tmp = 0
	if b < 0.0:
		tmp = (-b + t_0) / (2.0 * a)
	else:
		tmp = c / (a * ((-b - t_0) / (2.0 * a)))
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))
	tmp = 0.0
	if (b < 0.0)
		tmp = Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a));
	else
		tmp = Float64(c / Float64(a * Float64(Float64(Float64(-b) - t_0) / Float64(2.0 * a))));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
	tmp = 0.0;
	if (b < 0.0)
		tmp = (-b + t_0) / (2.0 * a);
	else
		tmp = c / (a * ((-b - t_0) / (2.0 * a)));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Less[b, 0.0], N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(c / N[(a * N[(N[((-b) - t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\
\mathbf{if}\;b < 0:\\
\;\;\;\;\frac{\left(-b\right) + t_0}{2 \cdot a}\\

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


\end{array}
\end{array}

Reproduce

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

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

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