The quadratic formula (r1)

Percentage Accurate: 52.5% → 84.9%
Time: 15.9s
Alternatives: 10
Speedup: 12.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 52.5% accurate, 1.0× speedup?

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

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

Alternative 1: 84.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -4.8 \cdot 10^{+31}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 1.65 \cdot 10^{-96}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -4.8e+31)
   (/ b (- a))
   (if (<= b 1.65e-96)
     (/ (- (sqrt (fma a (* c -4.0) (* b b))) b) (* a 2.0))
     (/ c (- b)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -4.8e+31) {
		tmp = b / -a;
	} else if (b <= 1.65e-96) {
		tmp = (sqrt(fma(a, (c * -4.0), (b * b))) - b) / (a * 2.0);
	} else {
		tmp = c / -b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -4.8e+31)
		tmp = Float64(b / Float64(-a));
	elseif (b <= 1.65e-96)
		tmp = Float64(Float64(sqrt(fma(a, Float64(c * -4.0), Float64(b * b))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(c / Float64(-b));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -4.8e+31], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 1.65e-96], N[(N[(N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision] + N[(b * b), $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 -4.8 \cdot 10^{+31}:\\
\;\;\;\;\frac{b}{-a}\\

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

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


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

    1. Initial program 55.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. *-commutative55.9%

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

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

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

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

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

    if -4.79999999999999965e31 < b < 1.64999999999999995e-96

    1. Initial program 85.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. *-commutative85.9%

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

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

    if 1.64999999999999995e-96 < 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 82.5%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified82.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.8 \cdot 10^{+31}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 1.65 \cdot 10^{-96}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 84.9% accurate, 0.9× speedup?

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

\mathbf{elif}\;b \leq 9.8 \cdot 10^{-98}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \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 < -4.79999999999999965e31

    1. Initial program 55.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. *-commutative55.9%

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

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

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

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

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

    if -4.79999999999999965e31 < b < 9.80000000000000028e-98

    1. Initial program 85.9%

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

    if 9.80000000000000028e-98 < 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 82.5%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified82.5%

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

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

Alternative 3: 81.1% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 4.2 \cdot 10^{-95}:\\
\;\;\;\;\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 < -1.9e-97

    1. Initial program 66.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. *-commutative66.1%

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

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

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

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

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

    if -1.9e-97 < b < 4.2e-95

    1. Initial program 81.7%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified81.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. Taylor expanded in a around inf 74.1%

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

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

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

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

    if 4.2e-95 < 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 82.5%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified82.5%

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

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

Alternative 4: 81.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 66.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. *-commutative66.1%

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

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

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

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

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

    if -1.9e-97 < b < 5.09999999999999973e-96

    1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.09999999999999973e-96 < 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 82.5%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified82.5%

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

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

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

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


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

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

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

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

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

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

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

    if -2.5999999999999998e-159 < b < 3.5000000000000002e-177

    1. Initial program 76.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. *-commutative76.5%

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

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

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

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

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

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

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

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

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

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

    if 3.5000000000000002e-177 < b

    1. Initial program 25.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. *-commutative25.9%

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

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

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

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

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

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

Alternative 6: 67.5% accurate, 12.9× speedup?

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

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

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


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

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

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

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

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

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

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

    if -9.999999999999969e-311 < b

    1. Initial program 33.7%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified33.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. Taylor expanded in a around 0 62.9%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified62.9%

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

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

Alternative 7: 42.2% accurate, 12.9× speedup?

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

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

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


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

    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.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 50.3%

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

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

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

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

    if 4.40000000000000006e86 < b

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified6.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. Taylor expanded in a around 0 96.3%

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

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

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

      \[\leadsto \color{blue}{\frac{-c}{b}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt44.1%

        \[\leadsto \frac{\color{blue}{\sqrt{-c} \cdot \sqrt{-c}}}{b} \]
      2. sqrt-unprod56.5%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-c\right) \cdot \left(-c\right)}}}{b} \]
      3. sqr-neg56.5%

        \[\leadsto \frac{\sqrt{\color{blue}{c \cdot c}}}{b} \]
      4. sqrt-unprod22.1%

        \[\leadsto \frac{\color{blue}{\sqrt{c} \cdot \sqrt{c}}}{b} \]
      5. add-sqr-sqrt31.3%

        \[\leadsto \frac{\color{blue}{c}}{b} \]
      6. div-inv31.3%

        \[\leadsto \color{blue}{c \cdot \frac{1}{b}} \]
    9. Applied egg-rr31.3%

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

        \[\leadsto \color{blue}{\frac{c \cdot 1}{b}} \]
      2. *-rgt-identity31.3%

        \[\leadsto \frac{\color{blue}{c}}{b} \]
    11. Simplified31.3%

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

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

Alternative 8: 10.7% 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 53.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. *-commutative53.6%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified53.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. Taylor expanded in a around 0 30.0%

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

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

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

    \[\leadsto \color{blue}{\frac{-c}{b}} \]
  8. Step-by-step derivation
    1. add-sqr-sqrt13.1%

      \[\leadsto \frac{\color{blue}{\sqrt{-c} \cdot \sqrt{-c}}}{b} \]
    2. sqrt-unprod15.9%

      \[\leadsto \frac{\color{blue}{\sqrt{\left(-c\right) \cdot \left(-c\right)}}}{b} \]
    3. sqr-neg15.9%

      \[\leadsto \frac{\sqrt{\color{blue}{c \cdot c}}}{b} \]
    4. sqrt-unprod5.4%

      \[\leadsto \frac{\color{blue}{\sqrt{c} \cdot \sqrt{c}}}{b} \]
    5. add-sqr-sqrt8.4%

      \[\leadsto \frac{\color{blue}{c}}{b} \]
    6. div-inv8.4%

      \[\leadsto \color{blue}{c \cdot \frac{1}{b}} \]
  9. Applied egg-rr8.4%

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

      \[\leadsto \color{blue}{\frac{c \cdot 1}{b}} \]
    2. *-rgt-identity8.4%

      \[\leadsto \frac{\color{blue}{c}}{b} \]
  11. Simplified8.4%

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

Alternative 9: 5.3% accurate, 38.7× speedup?

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

\\
\frac{a}{b}
\end{array}
Derivation
  1. Initial program 53.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. *-commutative53.6%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified53.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. Taylor expanded in b around -inf 40.9%

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

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

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

    \[\leadsto \color{blue}{\frac{-b}{a}} \]
  8. Step-by-step derivation
    1. neg-sub040.9%

      \[\leadsto \frac{\color{blue}{0 - b}}{a} \]
    2. flip3--13.1%

      \[\leadsto \frac{\color{blue}{\frac{{0}^{3} - {b}^{3}}{0 \cdot 0 + \left(b \cdot b + 0 \cdot b\right)}}}{a} \]
    3. metadata-eval13.1%

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{0 - {b}^{3}}{0 + \left({b}^{2} + 0 \cdot b\right)}}}{a} \]
  10. Step-by-step derivation
    1. sub0-neg13.1%

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

      \[\leadsto \frac{\frac{-{b}^{3}}{\color{blue}{{b}^{2} + 0 \cdot b}}}{a} \]
    3. mul0-lft13.1%

      \[\leadsto \frac{\frac{-{b}^{3}}{{b}^{2} + \color{blue}{0}}}{a} \]
    4. +-rgt-identity13.1%

      \[\leadsto \frac{\frac{-{b}^{3}}{\color{blue}{{b}^{2}}}}{a} \]
  11. Simplified13.1%

    \[\leadsto \frac{\color{blue}{\frac{-{b}^{3}}{{b}^{2}}}}{a} \]
  12. Step-by-step derivation
    1. div-inv13.1%

      \[\leadsto \color{blue}{\frac{-{b}^{3}}{{b}^{2}} \cdot \frac{1}{a}} \]
    2. add-sqr-sqrt12.4%

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

      \[\leadsto \color{blue}{\sqrt{\frac{-{b}^{3}}{{b}^{2}} \cdot \frac{-{b}^{3}}{{b}^{2}}}} \cdot \frac{1}{a} \]
    4. distribute-frac-neg13.1%

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

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

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

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

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

      \[\leadsto \sqrt{\left(-b\right) \cdot \left(-\color{blue}{{b}^{\left(3 - 2\right)}}\right)} \cdot \frac{1}{a} \]
    10. metadata-eval29.1%

      \[\leadsto \sqrt{\left(-b\right) \cdot \left(-{b}^{\color{blue}{1}}\right)} \cdot \frac{1}{a} \]
    11. pow129.1%

      \[\leadsto \sqrt{\left(-b\right) \cdot \left(-\color{blue}{b}\right)} \cdot \frac{1}{a} \]
    12. sqr-neg29.1%

      \[\leadsto \sqrt{\color{blue}{b \cdot b}} \cdot \frac{1}{a} \]
    13. unpow229.1%

      \[\leadsto \sqrt{\color{blue}{{b}^{2}}} \cdot \frac{1}{a} \]
    14. sqrt-pow12.3%

      \[\leadsto \color{blue}{{b}^{\left(\frac{2}{2}\right)}} \cdot \frac{1}{a} \]
    15. metadata-eval2.3%

      \[\leadsto {b}^{\color{blue}{1}} \cdot \frac{1}{a} \]
    16. pow12.3%

      \[\leadsto \color{blue}{b} \cdot \frac{1}{a} \]
  13. Applied egg-rr2.3%

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

      \[\leadsto \color{blue}{\frac{b \cdot 1}{a}} \]
    2. *-rgt-identity2.3%

      \[\leadsto \frac{\color{blue}{b}}{a} \]
  15. Simplified2.3%

    \[\leadsto \color{blue}{\frac{b}{a}} \]
  16. Applied egg-rr2.2%

    \[\leadsto \color{blue}{e^{\log a - \log b}} \]
  17. Step-by-step derivation
    1. exp-diff2.2%

      \[\leadsto \color{blue}{\frac{e^{\log a}}{e^{\log b}}} \]
    2. rem-exp-log4.2%

      \[\leadsto \frac{\color{blue}{a}}{e^{\log b}} \]
    3. rem-exp-log5.0%

      \[\leadsto \frac{a}{\color{blue}{b}} \]
  18. Simplified5.0%

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

Alternative 10: 2.4% accurate, 38.7× speedup?

\[\begin{array}{l} \\ b \cdot 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}

\\
b \cdot a
\end{array}
Derivation
  1. Initial program 53.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. *-commutative53.6%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified53.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. Taylor expanded in b around -inf 40.9%

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

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

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

    \[\leadsto \color{blue}{\frac{-b}{a}} \]
  8. Step-by-step derivation
    1. neg-sub040.9%

      \[\leadsto \frac{\color{blue}{0 - b}}{a} \]
    2. flip3--13.1%

      \[\leadsto \frac{\color{blue}{\frac{{0}^{3} - {b}^{3}}{0 \cdot 0 + \left(b \cdot b + 0 \cdot b\right)}}}{a} \]
    3. metadata-eval13.1%

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{0 - {b}^{3}}{0 + \left({b}^{2} + 0 \cdot b\right)}}}{a} \]
  10. Step-by-step derivation
    1. sub0-neg13.1%

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

      \[\leadsto \frac{\frac{-{b}^{3}}{\color{blue}{{b}^{2} + 0 \cdot b}}}{a} \]
    3. mul0-lft13.1%

      \[\leadsto \frac{\frac{-{b}^{3}}{{b}^{2} + \color{blue}{0}}}{a} \]
    4. +-rgt-identity13.1%

      \[\leadsto \frac{\frac{-{b}^{3}}{\color{blue}{{b}^{2}}}}{a} \]
  11. Simplified13.1%

    \[\leadsto \frac{\color{blue}{\frac{-{b}^{3}}{{b}^{2}}}}{a} \]
  12. Step-by-step derivation
    1. div-inv13.1%

      \[\leadsto \color{blue}{\frac{-{b}^{3}}{{b}^{2}} \cdot \frac{1}{a}} \]
    2. add-sqr-sqrt12.4%

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

      \[\leadsto \color{blue}{\sqrt{\frac{-{b}^{3}}{{b}^{2}} \cdot \frac{-{b}^{3}}{{b}^{2}}}} \cdot \frac{1}{a} \]
    4. distribute-frac-neg13.1%

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

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

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

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

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

      \[\leadsto \sqrt{\left(-b\right) \cdot \left(-\color{blue}{{b}^{\left(3 - 2\right)}}\right)} \cdot \frac{1}{a} \]
    10. metadata-eval29.1%

      \[\leadsto \sqrt{\left(-b\right) \cdot \left(-{b}^{\color{blue}{1}}\right)} \cdot \frac{1}{a} \]
    11. pow129.1%

      \[\leadsto \sqrt{\left(-b\right) \cdot \left(-\color{blue}{b}\right)} \cdot \frac{1}{a} \]
    12. sqr-neg29.1%

      \[\leadsto \sqrt{\color{blue}{b \cdot b}} \cdot \frac{1}{a} \]
    13. unpow229.1%

      \[\leadsto \sqrt{\color{blue}{{b}^{2}}} \cdot \frac{1}{a} \]
    14. sqrt-pow12.3%

      \[\leadsto \color{blue}{{b}^{\left(\frac{2}{2}\right)}} \cdot \frac{1}{a} \]
    15. metadata-eval2.3%

      \[\leadsto {b}^{\color{blue}{1}} \cdot \frac{1}{a} \]
    16. pow12.3%

      \[\leadsto \color{blue}{b} \cdot \frac{1}{a} \]
  13. Applied egg-rr2.3%

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

      \[\leadsto \color{blue}{\frac{b \cdot 1}{a}} \]
    2. *-rgt-identity2.3%

      \[\leadsto \frac{\color{blue}{b}}{a} \]
  15. Simplified2.3%

    \[\leadsto \color{blue}{\frac{b}{a}} \]
  16. Applied egg-rr2.5%

    \[\leadsto \color{blue}{a \cdot b} \]
  17. Step-by-step derivation
    1. *-commutative2.5%

      \[\leadsto \color{blue}{b \cdot a} \]
  18. Simplified2.5%

    \[\leadsto \color{blue}{b \cdot a} \]
  19. Add Preprocessing

Developer Target 1: 70.5% 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 2024152 
(FPCore (a b c)
  :name "The quadratic formula (r1)"
  :precision binary64

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

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