The quadratic formula (r1)

Percentage Accurate: 52.0% → 86.1%
Time: 15.2s
Alternatives: 8
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 8 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.0% 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: 86.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{+150}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 2.8 \cdot 10^{-68}:\\ \;\;\;\;\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 -2e+150)
   (/ (- b) a)
   (if (<= b 2.8e-68)
     (/ (- (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 <= -2e+150) {
		tmp = -b / a;
	} else if (b <= 2.8e-68) {
		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 <= (-2d+150)) then
        tmp = -b / a
    else if (b <= 2.8d-68) 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 <= -2e+150) {
		tmp = -b / a;
	} else if (b <= 2.8e-68) {
		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 <= -2e+150:
		tmp = -b / a
	elif b <= 2.8e-68:
		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 <= -2e+150)
		tmp = Float64(Float64(-b) / a);
	elseif (b <= 2.8e-68)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 4.0) * c))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -2e+150)
		tmp = -b / a;
	elseif (b <= 2.8e-68)
		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, -2e+150], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 2.8e-68], 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 -2 \cdot 10^{+150}:\\
\;\;\;\;\frac{-b}{a}\\

\mathbf{elif}\;b \leq 2.8 \cdot 10^{-68}:\\
\;\;\;\;\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 < -1.99999999999999996e150

    1. Initial program 36.3%

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

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

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

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

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

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

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

    if -1.99999999999999996e150 < b < 2.8000000000000001e-68

    1. Initial program 80.5%

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

    if 2.8000000000000001e-68 < b

    1. Initial program 11.3%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg91.3%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac91.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{+150}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 2.8 \cdot 10^{-68}:\\ \;\;\;\;\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: 80.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 65.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. *-commutative65.1%

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

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

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

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

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

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

    if -5.3000000000000003e-52 < b < 5.7999999999999996e-65

    1. Initial program 72.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. *-commutative72.4%

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

        \[\leadsto \frac{\left(-b\right) + \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)}}}{a \cdot 2} \]
      2. *-commutative72.0%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      3. fma-def72.0%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      4. associate-+l+72.0%

        \[\leadsto \frac{\left(-b\right) + \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)}}}{a \cdot 2} \]
      5. pow272.0%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      6. distribute-lft-neg-in72.0%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      7. *-commutative72.0%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      8. distribute-rgt-neg-in72.0%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      9. metadata-eval72.0%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      10. associate-*r*72.0%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      11. *-commutative72.0%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      12. *-commutative72.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.7999999999999996e-65 < b

    1. Initial program 11.3%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg91.3%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac91.3%

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

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

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

Alternative 3: 80.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 68.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. *-commutative68.1%

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

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

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

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

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

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

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

    if -7.00000000000000059e-79 < b < 8.8000000000000001e-69

    1. Initial program 69.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. *-commutative69.6%

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

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

        \[\leadsto \frac{\left(-b\right) + \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)}}}{a \cdot 2} \]
      2. *-commutative69.1%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      3. fma-def69.1%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      4. associate-+l+69.1%

        \[\leadsto \frac{\left(-b\right) + \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)}}}{a \cdot 2} \]
      5. pow269.1%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      6. distribute-lft-neg-in69.1%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      7. *-commutative69.1%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      8. distribute-rgt-neg-in69.1%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      9. metadata-eval69.1%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      10. associate-*r*69.1%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      11. *-commutative69.1%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      12. *-commutative69.1%

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

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

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

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

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

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

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

      \[\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-*l/63.7%

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

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

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

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

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

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

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

    if 8.8000000000000001e-69 < b

    1. Initial program 11.3%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg91.3%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac91.3%

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

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

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

Alternative 4: 71.4% accurate, 1.0× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

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

    if -1.0499999999999999e-179 < b < 8.7999999999999996e-101

    1. Initial program 65.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. *-commutative65.2%

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

      \[\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. prod-diff64.6%

        \[\leadsto \frac{\left(-b\right) + \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)}}}{a \cdot 2} \]
      2. *-commutative64.6%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      3. fma-def64.6%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      4. associate-+l+64.6%

        \[\leadsto \frac{\left(-b\right) + \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)}}}{a \cdot 2} \]
      5. pow264.6%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      6. distribute-lft-neg-in64.6%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      7. *-commutative64.6%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      8. distribute-rgt-neg-in64.6%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      9. metadata-eval64.6%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      10. associate-*r*64.6%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      11. *-commutative64.6%

        \[\leadsto \frac{\left(-b\right) + \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)}}{a \cdot 2} \]
      12. *-commutative64.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \sqrt{\left(-4 \cdot \left(c \cdot a\right)\right) \cdot \left({a}^{-1} \cdot \color{blue}{{a}^{-1}}\right)} \]
      9. pow-prod-up15.9%

        \[\leadsto 0.5 \cdot \sqrt{\left(-4 \cdot \left(c \cdot a\right)\right) \cdot \color{blue}{{a}^{\left(-1 + -1\right)}}} \]
      10. metadata-eval15.9%

        \[\leadsto 0.5 \cdot \sqrt{\left(-4 \cdot \left(c \cdot a\right)\right) \cdot {a}^{\color{blue}{-2}}} \]
    13. Applied egg-rr15.9%

      \[\leadsto 0.5 \cdot \color{blue}{\sqrt{\left(-4 \cdot \left(c \cdot a\right)\right) \cdot {a}^{-2}}} \]
    14. Step-by-step derivation
      1. *-commutative15.9%

        \[\leadsto 0.5 \cdot \sqrt{\left(-4 \cdot \color{blue}{\left(a \cdot c\right)}\right) \cdot {a}^{-2}} \]
      2. *-commutative15.9%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{\left(\left(a \cdot c\right) \cdot -4\right)} \cdot {a}^{-2}} \]
    15. Simplified15.9%

      \[\leadsto 0.5 \cdot \color{blue}{\sqrt{\left(\left(a \cdot c\right) \cdot -4\right) \cdot {a}^{-2}}} \]
    16. Taylor expanded in a around 0 39.5%

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

    if 8.7999999999999996e-101 < b

    1. Initial program 14.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. *-commutative14.8%

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

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

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

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac87.1%

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

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

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

Alternative 5: 42.8% accurate, 12.9× speedup?

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

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

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


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

    1. Initial program 64.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. *-commutative64.4%

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

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

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

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

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

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

    if 9e21 < b

    1. Initial program 11.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. *-commutative11.4%

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot b + 2 \cdot \frac{a \cdot c}{b}}}{a \cdot 2} \]
    6. Taylor expanded in b around 0 23.3%

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

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

Alternative 6: 67.4% accurate, 12.9× speedup?

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

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

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


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

    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{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around -inf 65.8%

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

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

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

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

    if 6.4000000000000003e-291 < 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{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around inf 73.4%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg73.4%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac73.4%

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

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

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

Alternative 7: 2.6% accurate, 38.7× speedup?

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

\\
\frac{b}{a}
\end{array}
Derivation
  1. Initial program 49.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. Simplified49.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{b}{a}} \]
    8. Final simplification2.7%

      \[\leadsto \frac{b}{a} \]
    9. Add Preprocessing

    Alternative 8: 11.0% accurate, 38.7× speedup?

    \[\begin{array}{l} \\ \frac{c}{b} \end{array} \]
    (FPCore (a b c) :precision binary64 (/ c b))
    double code(double a, double b, double c) {
    	return c / b;
    }
    
    real(8) function code(a, b, c)
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: c
        code = c / b
    end function
    
    public static double code(double a, double b, double c) {
    	return c / b;
    }
    
    def code(a, b, c):
    	return c / b
    
    function code(a, b, c)
    	return Float64(c / b)
    end
    
    function tmp = code(a, b, c)
    	tmp = c / b;
    end
    
    code[a_, b_, c_] := N[(c / b), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{c}{b}
    \end{array}
    
    Derivation
    1. Initial program 49.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. *-commutative49.5%

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot b + 2 \cdot \frac{a \cdot c}{b}}}{a \cdot 2} \]
    6. Taylor expanded in b around 0 8.7%

      \[\leadsto \color{blue}{\frac{c}{b}} \]
    7. Final simplification8.7%

      \[\leadsto \frac{c}{b} \]
    8. Add Preprocessing

    Developer target: 70.0% accurate, 0.9× speedup?

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

    Reproduce

    ?
    herbie shell --seed 2024021 
    (FPCore (a b c)
      :name "The quadratic formula (r1)"
      :precision binary64
    
      :herbie-target
      (if (< b 0.0) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) (/ c (* a (/ (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))))
    
      (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))