The quadratic formula (r2)

Percentage Accurate: 52.9% → 91.2%
Time: 16.7s
Alternatives: 7
Speedup: 19.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 7 alternatives:

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

Initial Program: 52.9% accurate, 1.0× speedup?

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

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

Alternative 1: 91.2% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 1.7%

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified97.7%

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

    if -1e153 < b < 8.4999999999999995e-307

    1. Initial program 42.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. sub-neg42.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.4999999999999995e-307 < b < 6.4999999999999998e75

    1. Initial program 85.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. sub-neg85.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.4999999999999998e75 < b

    1. Initial program 56.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+153}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{-307}:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot 4}{b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{+75}:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \]

Alternative 2: 85.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 11.2%

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

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

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

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

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

    if -1.02e-78 < b < 7.80000000000000075e75

    1. Initial program 78.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.80000000000000075e75 < b

    1. Initial program 56.9%

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

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

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

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

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

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

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

Alternative 3: 80.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 11.2%

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

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

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

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

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

    if -3.79999999999999992e-71 < b < 5.20000000000000004e-70

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.20000000000000004e-70 < b

    1. Initial program 65.5%

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

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

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

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

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

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

Alternative 4: 67.4% accurate, 12.8× speedup?

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

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

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


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

    1. Initial program 27.3%

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 70.3%

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

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

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

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

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

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

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

Alternative 5: 67.2% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 25.6%

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

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

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

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

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

    if -2.8e-266 < b

    1. Initial program 70.4%

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

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

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

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

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

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

Alternative 6: 34.6% accurate, 29.0× speedup?

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

\\
\frac{-b}{a}
\end{array}
Derivation
  1. Initial program 51.0%

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

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

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

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

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

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

Alternative 7: 2.6% accurate, 38.7× speedup?

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

\\
\frac{b}{a}
\end{array}
Derivation
  1. Initial program 51.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. add-cube-cbrt50.2%

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

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

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

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

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

Developer target: 71.4% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}

Reproduce

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

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

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