The quadratic formula (r1)

Percentage Accurate: 52.4% → 84.8%
Time: 14.3s
Alternatives: 10
Speedup: 12.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 52.4% accurate, 1.0× speedup?

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

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

Alternative 1: 84.8% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 41.7%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified94.8%

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

    if -8.40000000000000067e153 < b < 6.5999999999999996

    1. Initial program 83.5%

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

    if 6.5999999999999996 < b

    1. Initial program 8.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -8.4 \cdot 10^{+153}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 6.6:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 79.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.4 \cdot 10^{-89}:\\
\;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} - \frac{1}{a}\right)\\

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

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


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

    1. Initial program 74.8%

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

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

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

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

        \[\leadsto \color{blue}{-b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)} \]
      2. distribute-rgt-neg-in82.9%

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

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

        \[\leadsto b \cdot \left(-\left(\frac{1}{a} + \color{blue}{\left(-\frac{c}{{b}^{2}}\right)}\right)\right) \]
      5. unsub-neg82.9%

        \[\leadsto b \cdot \left(-\color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right)}\right) \]
    7. Simplified82.9%

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

    if -2.40000000000000016e-89 < b < 750

    1. Initial program 75.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 750 < b

    1. Initial program 8.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.4 \cdot 10^{-89}:\\ \;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} - \frac{1}{a}\right)\\ \mathbf{elif}\;b \leq 750:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 79.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.3 \cdot 10^{-85}:\\
\;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} - \frac{1}{a}\right)\\

\mathbf{elif}\;b \leq 6.6:\\
\;\;\;\;\left(\sqrt{a \cdot \left(c \cdot -4\right)} - b\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 < -4.29999999999999999e-85

    1. Initial program 74.8%

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

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

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

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

        \[\leadsto \color{blue}{-b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)} \]
      2. distribute-rgt-neg-in82.9%

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

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

        \[\leadsto b \cdot \left(-\left(\frac{1}{a} + \color{blue}{\left(-\frac{c}{{b}^{2}}\right)}\right)\right) \]
      5. unsub-neg82.9%

        \[\leadsto b \cdot \left(-\color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right)}\right) \]
    7. Simplified82.9%

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

    if -4.29999999999999999e-85 < b < 6.5999999999999996

    1. Initial program 75.4%

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

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

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

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

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

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

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

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

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

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

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

    if 6.5999999999999996 < b

    1. Initial program 8.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.3 \cdot 10^{-85}:\\ \;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} - \frac{1}{a}\right)\\ \mathbf{elif}\;b \leq 6.6:\\ \;\;\;\;\left(\sqrt{a \cdot \left(c \cdot -4\right)} - b\right) \cdot \frac{0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 71.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.25 \cdot 10^{-158}:\\
\;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} - \frac{1}{a}\right)\\

\mathbf{elif}\;b \leq 7.8 \cdot 10^{-80}:\\
\;\;\;\;0.5 \cdot \sqrt{c \cdot \frac{-4}{a}}\\

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


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

    1. Initial program 76.6%

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

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

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

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

        \[\leadsto \color{blue}{-b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)} \]
      2. distribute-rgt-neg-in80.7%

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

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

        \[\leadsto b \cdot \left(-\left(\frac{1}{a} + \color{blue}{\left(-\frac{c}{{b}^{2}}\right)}\right)\right) \]
      5. unsub-neg80.7%

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

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

    if -1.24999999999999993e-158 < b < 7.7999999999999995e-80

    1. Initial program 72.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \left(\sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
    8. Step-by-step derivation
      1. *-commutative0.0%

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

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

        \[\leadsto -0.5 \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      4. rem-cube-cbrt39.1%

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

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

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

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

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

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

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

        \[\leadsto {\left(0.5 \cdot \sqrt{\frac{\color{blue}{-4 \cdot c}}{a}}\right)}^{1} \]
      6. *-un-lft-identity39.1%

        \[\leadsto {\left(0.5 \cdot \sqrt{\frac{-4 \cdot c}{\color{blue}{1 \cdot a}}}\right)}^{1} \]
      7. times-frac39.0%

        \[\leadsto {\left(0.5 \cdot \sqrt{\color{blue}{\frac{-4}{1} \cdot \frac{c}{a}}}\right)}^{1} \]
      8. metadata-eval39.0%

        \[\leadsto {\left(0.5 \cdot \sqrt{\color{blue}{-4} \cdot \frac{c}{a}}\right)}^{1} \]
    11. Applied egg-rr39.0%

      \[\leadsto \color{blue}{{\left(0.5 \cdot \sqrt{-4 \cdot \frac{c}{a}}\right)}^{1}} \]
    12. Step-by-step derivation
      1. unpow139.0%

        \[\leadsto \color{blue}{0.5 \cdot \sqrt{-4 \cdot \frac{c}{a}}} \]
    13. Simplified39.0%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{-4 \cdot \frac{c}{a}}} \]
    14. Step-by-step derivation
      1. *-un-lft-identity39.0%

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\sqrt{c \cdot \frac{-4}{a}}} \]
    17. Simplified39.1%

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

    if 7.7999999999999995e-80 < b

    1. Initial program 20.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified81.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.25 \cdot 10^{-158}:\\ \;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} - \frac{1}{a}\right)\\ \mathbf{elif}\;b \leq 7.8 \cdot 10^{-80}:\\ \;\;\;\;0.5 \cdot \sqrt{c \cdot \frac{-4}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 71.0% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 7 \cdot 10^{-99}:\\
\;\;\;\;0.5 \cdot \sqrt{c \cdot \frac{-4}{a}}\\

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


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

    1. Initial program 76.6%

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

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

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

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

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

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

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

    if -1.4500000000000001e-156 < b < 6.9999999999999997e-99

    1. Initial program 72.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \left(\sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
    8. Step-by-step derivation
      1. *-commutative0.0%

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

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

        \[\leadsto -0.5 \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      4. rem-cube-cbrt39.1%

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

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

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

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

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

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

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

        \[\leadsto {\left(0.5 \cdot \sqrt{\frac{\color{blue}{-4 \cdot c}}{a}}\right)}^{1} \]
      6. *-un-lft-identity39.1%

        \[\leadsto {\left(0.5 \cdot \sqrt{\frac{-4 \cdot c}{\color{blue}{1 \cdot a}}}\right)}^{1} \]
      7. times-frac39.0%

        \[\leadsto {\left(0.5 \cdot \sqrt{\color{blue}{\frac{-4}{1} \cdot \frac{c}{a}}}\right)}^{1} \]
      8. metadata-eval39.0%

        \[\leadsto {\left(0.5 \cdot \sqrt{\color{blue}{-4} \cdot \frac{c}{a}}\right)}^{1} \]
    11. Applied egg-rr39.0%

      \[\leadsto \color{blue}{{\left(0.5 \cdot \sqrt{-4 \cdot \frac{c}{a}}\right)}^{1}} \]
    12. Step-by-step derivation
      1. unpow139.0%

        \[\leadsto \color{blue}{0.5 \cdot \sqrt{-4 \cdot \frac{c}{a}}} \]
    13. Simplified39.0%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{-4 \cdot \frac{c}{a}}} \]
    14. Step-by-step derivation
      1. *-un-lft-identity39.0%

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \color{blue}{\sqrt{c \cdot \frac{-4}{a}}} \]
    17. Simplified39.1%

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

    if 6.9999999999999997e-99 < b

    1. Initial program 20.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified81.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.45 \cdot 10^{-156}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 7 \cdot 10^{-99}:\\ \;\;\;\;0.5 \cdot \sqrt{c \cdot \frac{-4}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 71.0% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 1.02 \cdot 10^{-97}:\\
\;\;\;\;0.5 \cdot \sqrt{-4 \cdot \frac{c}{a}}\\

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


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

    1. Initial program 76.6%

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

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

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

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

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

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

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

    if -1.2e-155 < b < 1.02000000000000004e-97

    1. Initial program 72.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \left(\sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}} \cdot {\left(\sqrt{-1}\right)}^{2}\right)} \]
    8. Step-by-step derivation
      1. *-commutative0.0%

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

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

        \[\leadsto -0.5 \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      4. rem-cube-cbrt39.1%

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

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

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

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

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

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

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

        \[\leadsto {\left(0.5 \cdot \sqrt{\frac{\color{blue}{-4 \cdot c}}{a}}\right)}^{1} \]
      6. *-un-lft-identity39.1%

        \[\leadsto {\left(0.5 \cdot \sqrt{\frac{-4 \cdot c}{\color{blue}{1 \cdot a}}}\right)}^{1} \]
      7. times-frac39.0%

        \[\leadsto {\left(0.5 \cdot \sqrt{\color{blue}{\frac{-4}{1} \cdot \frac{c}{a}}}\right)}^{1} \]
      8. metadata-eval39.0%

        \[\leadsto {\left(0.5 \cdot \sqrt{\color{blue}{-4} \cdot \frac{c}{a}}\right)}^{1} \]
    11. Applied egg-rr39.0%

      \[\leadsto \color{blue}{{\left(0.5 \cdot \sqrt{-4 \cdot \frac{c}{a}}\right)}^{1}} \]
    12. Step-by-step derivation
      1. unpow139.0%

        \[\leadsto \color{blue}{0.5 \cdot \sqrt{-4 \cdot \frac{c}{a}}} \]
    13. Simplified39.0%

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

    if 1.02000000000000004e-97 < b

    1. Initial program 20.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified81.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.2 \cdot 10^{-155}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 1.02 \cdot 10^{-97}:\\ \;\;\;\;0.5 \cdot \sqrt{-4 \cdot \frac{c}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 66.9% accurate, 12.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \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 < -9.999999999999969e-311

    1. Initial program 78.4%

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < b

    1. Initial program 30.9%

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

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

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

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

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

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

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

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

Alternative 8: 42.8% accurate, 12.9× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1.3e18

    1. Initial program 74.7%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified50.8%

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

    if 1.3e18 < b

    1. Initial program 8.6%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{a \cdot -2}{b} \cdot c}}{a \cdot 2} \]
    7. Simplified66.8%

      \[\leadsto \frac{\color{blue}{\frac{a \cdot -2}{b} \cdot c}}{a \cdot 2} \]
    8. Step-by-step derivation
      1. associate-/l*58.0%

        \[\leadsto \color{blue}{\frac{a \cdot -2}{b} \cdot \frac{c}{a \cdot 2}} \]
      2. associate-/l*58.0%

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

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

        \[\leadsto \left(a \cdot \frac{\color{blue}{2}}{-b}\right) \cdot \frac{c}{a \cdot 2} \]
      5. add-sqr-sqrt0.0%

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

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

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

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

        \[\leadsto \left(a \cdot \frac{2}{\color{blue}{b}}\right) \cdot \frac{c}{a \cdot 2} \]
    9. Applied egg-rr30.6%

      \[\leadsto \color{blue}{\left(a \cdot \frac{2}{b}\right) \cdot \frac{c}{a \cdot 2}} \]
    10. Taylor expanded in a around 0 30.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.3 \cdot 10^{+18}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 11.1% accurate, 38.7× speedup?

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\left(-2 \cdot a\right) \cdot c}}{b}}{a \cdot 2} \]
    3. *-commutative26.0%

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

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

    \[\leadsto \frac{\color{blue}{\frac{a \cdot -2}{b} \cdot c}}{a \cdot 2} \]
  8. Step-by-step derivation
    1. associate-/l*22.8%

      \[\leadsto \color{blue}{\frac{a \cdot -2}{b} \cdot \frac{c}{a \cdot 2}} \]
    2. associate-/l*22.8%

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

      \[\leadsto \left(a \cdot \color{blue}{\frac{--2}{-b}}\right) \cdot \frac{c}{a \cdot 2} \]
    4. metadata-eval22.8%

      \[\leadsto \left(a \cdot \frac{\color{blue}{2}}{-b}\right) \cdot \frac{c}{a \cdot 2} \]
    5. add-sqr-sqrt1.0%

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

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

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

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

      \[\leadsto \left(a \cdot \frac{2}{\color{blue}{b}}\right) \cdot \frac{c}{a \cdot 2} \]
  9. Applied egg-rr11.0%

    \[\leadsto \color{blue}{\left(a \cdot \frac{2}{b}\right) \cdot \frac{c}{a \cdot 2}} \]
  10. Taylor expanded in a around 0 11.2%

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  11. Add Preprocessing

Alternative 10: 2.5% 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 55.1%

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. *-un-lft-identity55.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}\right) + \mathsf{fma}\left(b, 1, \color{blue}{1 \cdot b}\right)}{a \cdot 2} \]
    21. *-un-lft-identity32.0%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{b}{a}} \]
  10. Add Preprocessing

Developer Target 1: 70.7% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}

Reproduce

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

  :alt
  (! :herbie-platform default (let ((d (- (* b b) (* (* 4 a) c)))) (let ((r1 (/ (+ (- b) (sqrt d)) (* 2 a)))) (let ((r2 (/ (- (- b) (sqrt d)) (* 2 a)))) (if (< b 0) r1 (/ c (* a r2)))))))

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