Quadratic roots, full range

Percentage Accurate: 52.2% → 85.2%
Time: 13.9s
Alternatives: 11
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 11 alternatives:

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

Initial Program: 52.2% accurate, 1.0× speedup?

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

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

Alternative 1: 85.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+132}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 6 \cdot 10^{-118}:\\ \;\;\;\;\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 -1e+132)
   (/ b (- a))
   (if (<= b 6e-118)
     (/ (- (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 <= -1e+132) {
		tmp = b / -a;
	} else if (b <= 6e-118) {
		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 <= (-1d+132)) then
        tmp = b / -a
    else if (b <= 6d-118) 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 <= -1e+132) {
		tmp = b / -a;
	} else if (b <= 6e-118) {
		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 <= -1e+132:
		tmp = b / -a
	elif b <= 6e-118:
		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 <= -1e+132)
		tmp = Float64(b / Float64(-a));
	elseif (b <= 6e-118)
		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 <= -1e+132)
		tmp = b / -a;
	elseif (b <= 6e-118)
		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, -1e+132], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 6e-118], 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 -1 \cdot 10^{+132}:\\
\;\;\;\;\frac{b}{-a}\\

\mathbf{elif}\;b \leq 6 \cdot 10^{-118}:\\
\;\;\;\;\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 < -9.99999999999999991e131

    1. Initial program 45.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. *-commutative45.8%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified98.1%

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

    if -9.99999999999999991e131 < b < 6.00000000000000035e-118

    1. Initial program 84.5%

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

    if 6.00000000000000035e-118 < b

    1. Initial program 16.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. *-commutative16.9%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified85.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+132}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 6 \cdot 10^{-118}:\\ \;\;\;\;\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.9% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 67.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. *-commutative67.6%

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around -inf 83.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-neg83.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right) \cdot \left(-b\right)} \]
    8. Taylor expanded in a around inf 84.0%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    10. Applied egg-rr84.0%

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

    if -2.3000000000000001e-130 < b < 1.00000000000000003e-117

    1. Initial program 80.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. *-commutative80.4%

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

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

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

    if 1.00000000000000003e-117 < b

    1. Initial program 16.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. *-commutative16.9%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified85.1%

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

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

Alternative 3: 79.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 68.2%

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

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

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

      \[\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-neg83.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right) \cdot \left(-b\right)} \]
    8. Taylor expanded in a around inf 83.4%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    10. Applied egg-rr83.4%

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

    if -1.9500000000000001e-131 < b < 5.5999999999999998e-123

    1. Initial program 79.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. *-commutative79.5%

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

      \[\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. fma-undefine77.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\sqrt{-8 \cdot \left(a \cdot c\right) + 4 \cdot \left(a \cdot c\right)}}}{a \cdot 2} \]
    10. Step-by-step derivation
      1. distribute-rgt-out74.3%

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

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

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

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

    if 5.5999999999999998e-123 < b

    1. Initial program 16.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. *-commutative16.9%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified85.1%

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

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

Alternative 4: 79.7% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 10^{-117}:\\
\;\;\;\;\sqrt{a \cdot \left(c \cdot -4\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 < -1.9500000000000001e-131

    1. Initial program 68.2%

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

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

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

      \[\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-neg83.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right) \cdot \left(-b\right)} \]
    8. Taylor expanded in a around inf 83.4%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    10. Applied egg-rr83.4%

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

    if -1.9500000000000001e-131 < b < 1.00000000000000003e-117

    1. Initial program 79.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. *-commutative79.5%

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

      \[\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. fma-undefine77.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000003e-117 < b

    1. Initial program 16.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. *-commutative16.9%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified85.1%

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

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

Alternative 5: 71.4% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 2.9 \cdot 10^{-234}:\\
\;\;\;\;0.5 \cdot \frac{1}{\sqrt{\frac{\frac{a}{c}}{-4}}}\\

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


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

    1. Initial program 70.2%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around -inf 79.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-neg79.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right) \cdot \left(-b\right)} \]
    8. Taylor expanded in a around inf 80.1%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    10. Applied egg-rr80.1%

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

    if -5.50000000000000054e-175 < b < 2.90000000000000016e-234

    1. Initial program 81.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. *-commutative81.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified77.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. fma-undefine77.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{-8 \cdot c + 4 \cdot c}{a}}} \]
    10. Step-by-step derivation
      1. distribute-rgt-out31.0%

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

        \[\leadsto 0.5 \cdot \sqrt{\frac{c \cdot \color{blue}{-4}}{a}} \]
      3. associate-/l*31.0%

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{c \cdot \frac{-4}{a}}} \]
    12. Step-by-step derivation
      1. associate-*r/31.0%

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

      \[\leadsto 0.5 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}} \]
    14. Step-by-step derivation
      1. clear-num31.1%

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

        \[\leadsto 0.5 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{a}{c \cdot -4}}}} \]
      3. metadata-eval33.1%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{a}{c \cdot -4}}} \]
    15. Applied egg-rr33.1%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\sqrt{\frac{a}{c \cdot -4}}}} \]
    16. Step-by-step derivation
      1. associate-/r*33.1%

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

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

    if 2.90000000000000016e-234 < b

    1. Initial program 24.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. *-commutative24.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.5 \cdot 10^{-175}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 2.9 \cdot 10^{-234}:\\ \;\;\;\;0.5 \cdot \frac{1}{\sqrt{\frac{\frac{a}{c}}{-4}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 70.9% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 3.7 \cdot 10^{-234}:\\
\;\;\;\;0.5 \cdot \sqrt{\frac{1}{\frac{a}{c \cdot -4}}}\\

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


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

    1. Initial program 70.2%

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

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

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

      \[\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-neg77.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right) \cdot \left(-b\right)} \]
    8. Taylor expanded in a around inf 78.1%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    10. Applied egg-rr78.1%

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

    if -6.5000000000000001e-207 < b < 3.70000000000000012e-234

    1. Initial program 83.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. *-commutative83.8%

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

      \[\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. fma-undefine78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{-8 \cdot c + 4 \cdot c}{a}}} \]
    10. Step-by-step derivation
      1. distribute-rgt-out35.5%

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

        \[\leadsto 0.5 \cdot \sqrt{\frac{c \cdot \color{blue}{-4}}{a}} \]
      3. associate-/l*35.5%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{c \cdot \frac{-4}{a}}} \]
    11. Simplified35.5%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{c \cdot \frac{-4}{a}}} \]
    12. Step-by-step derivation
      1. associate-*r/35.5%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}} \]
      2. clear-num35.6%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{\frac{1}{\frac{a}{c \cdot -4}}}} \]
    13. Applied egg-rr35.6%

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

    if 3.70000000000000012e-234 < b

    1. Initial program 24.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. *-commutative24.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.5 \cdot 10^{-207}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 3.7 \cdot 10^{-234}:\\ \;\;\;\;0.5 \cdot \sqrt{\frac{1}{\frac{a}{c \cdot -4}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 70.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -6.5 \cdot 10^{-207}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 3.7 \cdot 10^{-234}:\\ \;\;\;\;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 -6.5e-207)
   (- (/ c b) (/ b a))
   (if (<= b 3.7e-234) (* 0.5 (sqrt (* c (/ -4.0 a)))) (/ c (- b)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -6.5e-207) {
		tmp = (c / b) - (b / a);
	} else if (b <= 3.7e-234) {
		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 <= (-6.5d-207)) then
        tmp = (c / b) - (b / a)
    else if (b <= 3.7d-234) 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 <= -6.5e-207) {
		tmp = (c / b) - (b / a);
	} else if (b <= 3.7e-234) {
		tmp = 0.5 * Math.sqrt((c * (-4.0 / a)));
	} else {
		tmp = c / -b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -6.5e-207:
		tmp = (c / b) - (b / a)
	elif b <= 3.7e-234:
		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 <= -6.5e-207)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif (b <= 3.7e-234)
		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 <= -6.5e-207)
		tmp = (c / b) - (b / a);
	elseif (b <= 3.7e-234)
		tmp = 0.5 * sqrt((c * (-4.0 / a)));
	else
		tmp = c / -b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -6.5e-207], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.7e-234], 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 -6.5 \cdot 10^{-207}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

\mathbf{elif}\;b \leq 3.7 \cdot 10^{-234}:\\
\;\;\;\;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 < -6.5000000000000001e-207

    1. Initial program 70.2%

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

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

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

      \[\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-neg77.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right) \cdot \left(-b\right)} \]
    8. Taylor expanded in a around inf 78.1%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    10. Applied egg-rr78.1%

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

    if -6.5000000000000001e-207 < b < 3.70000000000000012e-234

    1. Initial program 83.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. *-commutative83.8%

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

      \[\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. fma-undefine78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{-8 \cdot c + 4 \cdot c}{a}}} \]
    10. Step-by-step derivation
      1. distribute-rgt-out35.5%

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

        \[\leadsto 0.5 \cdot \sqrt{\frac{c \cdot \color{blue}{-4}}{a}} \]
      3. associate-/l*35.5%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{c \cdot \frac{-4}{a}}} \]
    11. Simplified35.5%

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

    if 3.70000000000000012e-234 < b

    1. Initial program 24.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. *-commutative24.9%

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

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

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

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

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

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

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

Alternative 8: 67.7% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 70.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. *-commutative70.8%

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

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

      \[\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-neg72.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right) \cdot \left(-b\right)} \]
    8. Taylor expanded in a around inf 72.7%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    10. Applied egg-rr72.7%

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

    if -1.999999999999994e-310 < b

    1. Initial program 29.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. *-commutative29.1%

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

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

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

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

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

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

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

Alternative 9: 67.5% accurate, 12.9× speedup?

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

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

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


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

    1. Initial program 70.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. *-commutative70.8%

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

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

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

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

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

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

    if 1.5499999999999999e-307 < b

    1. Initial program 29.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. *-commutative29.1%

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

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

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

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

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

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

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

Alternative 10: 43.5% accurate, 12.9× speedup?

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

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

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


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

    1. Initial program 71.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. *-commutative71.9%

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

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

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

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

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

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

    if 1.39999999999999998e-170 < b

    1. Initial program 21.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. *-commutative21.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified21.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. Step-by-step derivation
      1. add-cube-cbrt21.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(b + -1 \cdot b\right)}{a}} \]
      2. distribute-rgt1-in21.9%

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

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{0} \cdot b\right)}{a} \]
      4. mul0-lft21.9%

        \[\leadsto \frac{0.5 \cdot \color{blue}{0}}{a} \]
      5. metadata-eval21.9%

        \[\leadsto \frac{\color{blue}{0}}{a} \]
    13. Simplified21.9%

      \[\leadsto \color{blue}{\frac{0}{a}} \]
    14. Taylor expanded in a around 0 21.9%

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

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

Alternative 11: 10.9% accurate, 116.0× speedup?

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

\\
0
\end{array}
Derivation
  1. Initial program 48.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. *-commutative48.8%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified48.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-cbrt48.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{0.5 \cdot \left(\color{blue}{0} \cdot b\right)}{a} \]
    4. mul0-lft11.4%

      \[\leadsto \frac{0.5 \cdot \color{blue}{0}}{a} \]
    5. metadata-eval11.4%

      \[\leadsto \frac{\color{blue}{0}}{a} \]
  13. Simplified11.4%

    \[\leadsto \color{blue}{\frac{0}{a}} \]
  14. Taylor expanded in a around 0 11.4%

    \[\leadsto \color{blue}{0} \]
  15. Add Preprocessing

Reproduce

?
herbie shell --seed 2024148 
(FPCore (a b c)
  :name "Quadratic roots, full range"
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))