quadp (p42, positive)

Percentage Accurate: 52.1% → 87.6%
Time: 12.7s
Alternatives: 12
Speedup: 19.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 52.1% accurate, 1.0× speedup?

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

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

Alternative 1: 87.6% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999983e117 < b < 5.8e-154

    1. Initial program 86.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.8e-154 < b < 1.4000000000000001e78

    1. Initial program 50.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4000000000000001e78 < b

    1. Initial program 14.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+117}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 5.8 \cdot 10^{-154}:\\ \;\;\;\;\frac{\left(b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}\right) \cdot -0.5}{a}\\ \mathbf{elif}\;b \leq 1.4 \cdot 10^{+78}:\\ \;\;\;\;\frac{-0.5 \cdot \frac{c \cdot \left(a \cdot 4\right)}{a}}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 2: 86.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot \left(c \cdot 4\right)\\ \mathbf{if}\;b \leq -1.85 \cdot 10^{+79}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 2.5 \cdot 10^{-98}:\\ \;\;\;\;\frac{0.5}{\frac{-a}{b - \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{+36}:\\ \;\;\;\;\frac{-0.5 \cdot \frac{t_0}{b + \sqrt{b \cdot b - t_0}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* a (* c 4.0))))
   (if (<= b -1.85e+79)
     (- (/ c b) (/ b a))
     (if (<= b 2.5e-98)
       (/ 0.5 (/ (- a) (- b (sqrt (fma b b (* a (* c -4.0)))))))
       (if (<= b 2.4e+36)
         (/ (* -0.5 (/ t_0 (+ b (sqrt (- (* b b) t_0))))) a)
         (/ (- c) b))))))
double code(double a, double b, double c) {
	double t_0 = a * (c * 4.0);
	double tmp;
	if (b <= -1.85e+79) {
		tmp = (c / b) - (b / a);
	} else if (b <= 2.5e-98) {
		tmp = 0.5 / (-a / (b - sqrt(fma(b, b, (a * (c * -4.0))))));
	} else if (b <= 2.4e+36) {
		tmp = (-0.5 * (t_0 / (b + sqrt(((b * b) - t_0))))) / a;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(a * Float64(c * 4.0))
	tmp = 0.0
	if (b <= -1.85e+79)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif (b <= 2.5e-98)
		tmp = Float64(0.5 / Float64(Float64(-a) / Float64(b - sqrt(fma(b, b, Float64(a * Float64(c * -4.0)))))));
	elseif (b <= 2.4e+36)
		tmp = Float64(Float64(-0.5 * Float64(t_0 / Float64(b + sqrt(Float64(Float64(b * b) - t_0))))) / a);
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.85e+79], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.5e-98], N[(0.5 / N[((-a) / N[(b - N[Sqrt[N[(b * b + N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.4e+36], N[(N[(-0.5 * N[(t$95$0 / N[(b + N[Sqrt[N[(N[(b * b), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;b \leq 2.4 \cdot 10^{+36}:\\
\;\;\;\;\frac{-0.5 \cdot \frac{t_0}{b + \sqrt{b \cdot b - t_0}}}{a}\\

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


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

    1. Initial program 76.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.85000000000000005e79 < b < 2.50000000000000009e-98

    1. Initial program 83.4%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
    4. Step-by-step derivation
      1. associate-*r/83.4%

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

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

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

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

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

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

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

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

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

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

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

    if 2.50000000000000009e-98 < b < 2.39999999999999992e36

    1. Initial program 55.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.39999999999999992e36 < b

    1. Initial program 16.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.85 \cdot 10^{+79}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 2.5 \cdot 10^{-98}:\\ \;\;\;\;\frac{0.5}{\frac{-a}{b - \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{+36}:\\ \;\;\;\;\frac{-0.5 \cdot \frac{a \cdot \left(c \cdot 4\right)}{b + \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 3: 87.4% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;b \leq 1.35 \cdot 10^{-157}:\\
\;\;\;\;\frac{\left(b - t_1\right) \cdot -0.5}{a}\\

\mathbf{elif}\;b \leq 1.4 \cdot 10^{+37}:\\
\;\;\;\;\frac{t_0}{b + t_1} \cdot \frac{-0.5}{a}\\

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


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

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4e114 < b < 1.35e-157

    1. Initial program 86.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.35e-157 < b < 1.3999999999999999e37

    1. Initial program 60.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.3999999999999999e37 < b

    1. Initial program 16.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{+114}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.35 \cdot 10^{-157}:\\ \;\;\;\;\frac{\left(b - \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}\right) \cdot -0.5}{a}\\ \mathbf{elif}\;b \leq 1.4 \cdot 10^{+37}:\\ \;\;\;\;\frac{a \cdot \left(c \cdot 4\right)}{b + \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)}} \cdot \frac{-0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 4: 87.1% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;b \leq 2.5 \cdot 10^{-98}:\\
\;\;\;\;\frac{\left(b - t_1\right) \cdot -0.5}{a}\\

\mathbf{elif}\;b \leq 1.6 \cdot 10^{+36}:\\
\;\;\;\;\frac{-0.5 \cdot \frac{t_0}{b + t_1}}{a}\\

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


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

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4e114 < b < 2.50000000000000009e-98

    1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.50000000000000009e-98 < b < 1.5999999999999999e36

    1. Initial program 55.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.5999999999999999e36 < b

    1. Initial program 16.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 78.2% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 8.2 \cdot 10^{-111}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;b \leq 3.1 \cdot 10^{-33}:\\
\;\;\;\;\frac{0.5}{0.5 \cdot \frac{a}{b} + -0.5 \cdot \frac{b}{c}}\\

\mathbf{elif}\;b \leq 1.8 \cdot 10^{+33}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 83.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.00000000000000032e-103 < b < 8.19999999999999936e-111 or 3.09999999999999997e-33 < b < 1.8000000000000001e33

    1. Initial program 75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.19999999999999936e-111 < b < 3.09999999999999997e-33

    1. Initial program 37.5%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
    4. Step-by-step derivation
      1. associate-*r/37.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.8000000000000001e33 < b

    1. Initial program 16.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -7 \cdot 10^{-103}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 8.2 \cdot 10^{-111}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \sqrt{a \cdot \left(c \cdot -4\right)}\right)\\ \mathbf{elif}\;b \leq 3.1 \cdot 10^{-33}:\\ \;\;\;\;\frac{0.5}{0.5 \cdot \frac{a}{b} + -0.5 \cdot \frac{b}{c}}\\ \mathbf{elif}\;b \leq 1.8 \cdot 10^{+33}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \sqrt{a \cdot \left(c \cdot -4\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 6: 78.4% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 1.6 \cdot 10^{-99}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;b \leq 1.8 \cdot 10^{-34}:\\
\;\;\;\;\frac{0.5}{0.5 \cdot \frac{a}{b} + -0.5 \cdot \frac{b}{c}}\\

\mathbf{elif}\;b \leq 1.8 \cdot 10^{+33}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 83.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.8000000000000004e-103 < b < 1.6e-99 or 1.80000000000000004e-34 < b < 1.8000000000000001e33

    1. Initial program 75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.6e-99 < b < 1.80000000000000004e-34

    1. Initial program 37.5%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
    4. Step-by-step derivation
      1. associate-*r/37.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.8000000000000001e33 < b

    1. Initial program 16.8%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -7.8 \cdot 10^{-103}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.6 \cdot 10^{-99}:\\ \;\;\;\;\frac{-0.5 \cdot \left(b - \sqrt{a \cdot \left(c \cdot -4\right)}\right)}{a}\\ \mathbf{elif}\;b \leq 1.8 \cdot 10^{-34}:\\ \;\;\;\;\frac{0.5}{0.5 \cdot \frac{a}{b} + -0.5 \cdot \frac{b}{c}}\\ \mathbf{elif}\;b \leq 1.8 \cdot 10^{+33}:\\ \;\;\;\;\frac{-0.5 \cdot \left(b - \sqrt{a \cdot \left(c \cdot -4\right)}\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 7: 83.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 75.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.1999999999999995e83 < b < 1.8000000000000001e33

    1. Initial program 78.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.8000000000000001e33 < b

    1. Initial program 16.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 83.2% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000000008e115 < b < 1.74999999999999999e34

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.74999999999999999e34 < b

    1. Initial program 16.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 68.3% accurate, 12.8× speedup?

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

    1. Initial program 82.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < b

    1. Initial program 38.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 43.3% accurate, 19.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 82.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < b

    1. Initial program 38.5%

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

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

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

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

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

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

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

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

      \[\leadsto \left(b - \sqrt{\color{blue}{{b}^{2}}}\right) \cdot \frac{-0.5}{a} \]
    5. Step-by-step derivation
      1. unpow29.6%

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

      \[\leadsto \left(b - \sqrt{\color{blue}{b \cdot b}}\right) \cdot \frac{-0.5}{a} \]
    7. Taylor expanded in b around 0 22.5%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification43.2%

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

Alternative 11: 68.1% accurate, 19.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \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 < -1.999999999999994e-310

    1. Initial program 82.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < b

    1. Initial program 38.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 11.0% accurate, 116.0× speedup?

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

\\
0
\end{array}
Derivation
  1. Initial program 59.1%

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

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

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

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

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

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

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

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

    \[\leadsto \left(b - \sqrt{\color{blue}{{b}^{2}}}\right) \cdot \frac{-0.5}{a} \]
  5. Step-by-step derivation
    1. unpow231.8%

      \[\leadsto \left(b - \sqrt{\color{blue}{b \cdot b}}\right) \cdot \frac{-0.5}{a} \]
  6. Simplified31.8%

    \[\leadsto \left(b - \sqrt{\color{blue}{b \cdot b}}\right) \cdot \frac{-0.5}{a} \]
  7. Taylor expanded in b around 0 13.2%

    \[\leadsto \color{blue}{0} \]
  8. Final simplification13.2%

    \[\leadsto 0 \]

Developer target: 70.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\\ \mathbf{if}\;b < 0:\\ \;\;\;\;\frac{\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(4.0 * Float64(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[(4.0 * N[(a * c), $MachinePrecision]), $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 - 4 \cdot \left(a \cdot c\right)}\\
\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 2023258 
(FPCore (a b c)
  :name "quadp (p42, positive)"
  :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)))