quadp (p42, positive)

Percentage Accurate: 64.5% → 87.3%
Time: 17.9s
Alternatives: 10
Speedup: 5.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 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: 64.5% accurate, 1.0× speedup?

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

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

Alternative 1: 87.3% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -24000000:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{0}{a \cdot 2}\\


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

    1. Initial program 64.8%

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

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

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

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

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

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

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

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

    if -2.4e7 < b < 5.00000000000000024e148

    1. Initial program 76.8%

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

    if 5.00000000000000024e148 < b

    1. Initial program 6.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{b + -1 \cdot b}}{a \cdot 2} \]
    8. Step-by-step derivation
      1. distribute-rgt1-in100.0%

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

        \[\leadsto \frac{\color{blue}{0} \cdot b}{a \cdot 2} \]
      3. mul0-lft100.0%

        \[\leadsto \frac{\color{blue}{0}}{a \cdot 2} \]
    9. Simplified100.0%

      \[\leadsto \frac{\color{blue}{0}}{a \cdot 2} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.9%

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

Alternative 2: 79.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 70.7%

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

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

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

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

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

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

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

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

    if -1.9000000000000001e-56 < b < 1.04999999999999996e-60

    1. Initial program 71.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.04999999999999996e-60 < b

    1. Initial program 49.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\left(b + a \cdot \frac{c \cdot -2}{b}\right) - b}}{a \cdot 2} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification79.2%

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

Alternative 3: 79.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 70.7%

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

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

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

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

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

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

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

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

    if -1.2200000000000001e-57 < b < 8.6000000000000007e-61

    1. Initial program 71.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{{\left(e^{0.25 \cdot \left(\log \left(-4 \cdot a\right) + -1 \cdot \log \left(\frac{1}{c}\right)\right)}\right)}^{2} - b}}{a \cdot 2} \]
    8. Step-by-step derivation
      1. unpow234.4%

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

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

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

    if 8.6000000000000007e-61 < b

    1. Initial program 49.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\left(b + a \cdot \frac{c \cdot -2}{b}\right) - b}}{a \cdot 2} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification79.2%

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

Alternative 4: 64.7% accurate, 5.8× speedup?

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

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

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


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

    1. Initial program 72.8%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 54.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\left(b + a \cdot \frac{c \cdot -2}{b}\right) - b}}{a \cdot 2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.2%

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

Alternative 5: 46.6% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 72.8%

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

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

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

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

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

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

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

    if 3.00000000000000022e-308 < b

    1. Initial program 54.4%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a}{\frac{b}{c}}}}{a \cdot 2} \]
    8. Step-by-step derivation
      1. add-exp-log31.7%

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

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

        \[\leadsto e^{\log \color{blue}{\left(\frac{-2}{2} \cdot \frac{\frac{a}{\frac{b}{c}}}{a}\right)}} \]
      4. metadata-eval31.7%

        \[\leadsto e^{\log \left(\color{blue}{-1} \cdot \frac{\frac{a}{\frac{b}{c}}}{a}\right)} \]
      5. div-inv31.7%

        \[\leadsto e^{\log \left(-1 \cdot \frac{\color{blue}{a \cdot \frac{1}{\frac{b}{c}}}}{a}\right)} \]
      6. clear-num31.2%

        \[\leadsto e^{\log \left(-1 \cdot \frac{a \cdot \color{blue}{\frac{c}{b}}}{a}\right)} \]
    9. Applied egg-rr31.2%

      \[\leadsto \color{blue}{e^{\log \left(-1 \cdot \frac{a \cdot \frac{c}{b}}{a}\right)}} \]
    10. Taylor expanded in a around 0 22.3%

      \[\leadsto e^{\color{blue}{\log \left(-1 \cdot \frac{c}{b}\right)}} \]
    11. Step-by-step derivation
      1. associate-*r/22.3%

        \[\leadsto e^{\log \color{blue}{\left(\frac{-1 \cdot c}{b}\right)}} \]
      2. mul-1-neg22.3%

        \[\leadsto e^{\log \left(\frac{\color{blue}{-c}}{b}\right)} \]
    12. Simplified22.3%

      \[\leadsto e^{\color{blue}{\log \left(\frac{-c}{b}\right)}} \]
    13. Step-by-step derivation
      1. rem-exp-log27.1%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
      2. clear-num28.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{b}{-c}}} \]
      3. frac-2neg28.0%

        \[\leadsto \color{blue}{\frac{-1}{-\frac{b}{-c}}} \]
      4. metadata-eval28.0%

        \[\leadsto \frac{\color{blue}{-1}}{-\frac{b}{-c}} \]
      5. add-sqr-sqrt13.1%

        \[\leadsto \frac{-1}{-\frac{b}{\color{blue}{\sqrt{-c} \cdot \sqrt{-c}}}} \]
      6. sqrt-unprod28.8%

        \[\leadsto \frac{-1}{-\frac{b}{\color{blue}{\sqrt{\left(-c\right) \cdot \left(-c\right)}}}} \]
      7. sqr-neg28.8%

        \[\leadsto \frac{-1}{-\frac{b}{\sqrt{\color{blue}{c \cdot c}}}} \]
      8. sqrt-unprod11.9%

        \[\leadsto \frac{-1}{-\frac{b}{\color{blue}{\sqrt{c} \cdot \sqrt{c}}}} \]
      9. add-sqr-sqrt20.4%

        \[\leadsto \frac{-1}{-\frac{b}{\color{blue}{c}}} \]
      10. distribute-frac-neg20.4%

        \[\leadsto \frac{-1}{\color{blue}{\frac{-b}{c}}} \]
      11. add-sqr-sqrt0.0%

        \[\leadsto \frac{-1}{\frac{\color{blue}{\sqrt{-b} \cdot \sqrt{-b}}}{c}} \]
      12. sqrt-unprod43.7%

        \[\leadsto \frac{-1}{\frac{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right)}}}{c}} \]
      13. sqr-neg43.7%

        \[\leadsto \frac{-1}{\frac{\sqrt{\color{blue}{b \cdot b}}}{c}} \]
      14. sqrt-unprod27.9%

        \[\leadsto \frac{-1}{\frac{\color{blue}{\sqrt{b} \cdot \sqrt{b}}}{c}} \]
      15. add-sqr-sqrt28.0%

        \[\leadsto \frac{-1}{\frac{\color{blue}{b}}{c}} \]
    14. Applied egg-rr28.0%

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

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

Alternative 6: 64.0% accurate, 11.6× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{0}{a \cdot 2}\\


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

    1. Initial program 72.4%

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

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

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

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

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

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

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

    if -7.4000000000000003e-300 < b

    1. Initial program 55.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{b + -1 \cdot b}}{a \cdot 2} \]
    8. Step-by-step derivation
      1. distribute-rgt1-in58.8%

        \[\leadsto \frac{\color{blue}{\left(-1 + 1\right) \cdot b}}{a \cdot 2} \]
      2. metadata-eval58.8%

        \[\leadsto \frac{\color{blue}{0} \cdot b}{a \cdot 2} \]
      3. mul0-lft58.8%

        \[\leadsto \frac{\color{blue}{0}}{a \cdot 2} \]
    9. Simplified58.8%

      \[\leadsto \frac{\color{blue}{0}}{a \cdot 2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification63.3%

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

Alternative 7: 43.1% accurate, 12.9× speedup?

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

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

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


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

    1. Initial program 71.1%

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

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

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

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

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

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

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

    if 3.9e14 < b

    1. Initial program 47.5%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a}{\frac{b}{c}}}}{a \cdot 2} \]
    8. Step-by-step derivation
      1. frac-2neg47.4%

        \[\leadsto \color{blue}{\frac{--2 \cdot \frac{a}{\frac{b}{c}}}{-a \cdot 2}} \]
      2. div-inv47.4%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(-\frac{a}{\color{blue}{-\frac{b}{c}}}\right) \cdot -2\right) \cdot \frac{1}{-a \cdot 2} \]
      11. distribute-frac-neg40.3%

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

        \[\leadsto \left(\color{blue}{\frac{a}{\frac{b}{c}}} \cdot -2\right) \cdot \frac{1}{-a \cdot 2} \]
      13. div-inv40.3%

        \[\leadsto \left(\color{blue}{\left(a \cdot \frac{1}{\frac{b}{c}}\right)} \cdot -2\right) \cdot \frac{1}{-a \cdot 2} \]
      14. clear-num39.4%

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

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

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

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

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

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

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

Alternative 8: 46.3% accurate, 12.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \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 < -4.999999999999985e-310

    1. Initial program 72.8%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 54.4%

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

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

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

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

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

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

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

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

Alternative 9: 2.5% accurate, 38.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{4 \cdot \frac{b}{c \cdot {\left(\sqrt{-4}\right)}^{2}} + \frac{a}{b}}} \]
  11. Step-by-step derivation
    1. associate-*r/0.0%

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

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

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

      \[\leadsto \frac{1}{\frac{4}{\color{blue}{\sqrt{-4} \cdot \sqrt{-4}}} \cdot \frac{b}{c} + \frac{a}{b}} \]
    5. rem-square-sqrt15.8%

      \[\leadsto \frac{1}{\frac{4}{\color{blue}{-4}} \cdot \frac{b}{c} + \frac{a}{b}} \]
    6. metadata-eval15.8%

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

      \[\leadsto \frac{1}{\color{blue}{\left(-\frac{b}{c}\right)} + \frac{a}{b}} \]
    8. distribute-neg-frac15.8%

      \[\leadsto \frac{1}{\color{blue}{\frac{-b}{c}} + \frac{a}{b}} \]
  12. Simplified15.8%

    \[\leadsto \frac{1}{\color{blue}{\frac{-b}{c} + \frac{a}{b}}} \]
  13. Taylor expanded in b around 0 2.6%

    \[\leadsto \color{blue}{\frac{b}{a}} \]
  14. Final simplification2.6%

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

Alternative 10: 10.9% 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 63.5%

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a}{\frac{b}{c}}}}{a \cdot 2} \]
  8. Step-by-step derivation
    1. frac-2neg19.2%

      \[\leadsto \color{blue}{\frac{--2 \cdot \frac{a}{\frac{b}{c}}}{-a \cdot 2}} \]
    2. div-inv19.2%

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

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

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

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

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

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

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

      \[\leadsto \left(\left(-\frac{a}{\frac{\color{blue}{-b}}{c}}\right) \cdot -2\right) \cdot \frac{1}{-a \cdot 2} \]
    10. distribute-neg-frac16.0%

      \[\leadsto \left(\left(-\frac{a}{\color{blue}{-\frac{b}{c}}}\right) \cdot -2\right) \cdot \frac{1}{-a \cdot 2} \]
    11. distribute-frac-neg16.0%

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

      \[\leadsto \left(\color{blue}{\frac{a}{\frac{b}{c}}} \cdot -2\right) \cdot \frac{1}{-a \cdot 2} \]
    13. div-inv16.0%

      \[\leadsto \left(\color{blue}{\left(a \cdot \frac{1}{\frac{b}{c}}\right)} \cdot -2\right) \cdot \frac{1}{-a \cdot 2} \]
    14. clear-num15.8%

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  11. Final simplification11.6%

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

Developer target: 79.0% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|\frac{b}{2}\right|\\ t_1 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\ t_2 := \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\ \;\;\;\;\sqrt{t\_0 - t\_1} \cdot \sqrt{t\_0 + t\_1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{hypot}\left(\frac{b}{2}, t\_1\right)\\ \end{array}\\ \mathbf{if}\;b < 0:\\ \;\;\;\;\frac{t\_2 - \frac{b}{2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{\frac{b}{2} + t\_2}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fabs (/ b 2.0)))
        (t_1 (* (sqrt (fabs a)) (sqrt (fabs c))))
        (t_2
         (if (== (copysign a c) a)
           (* (sqrt (- t_0 t_1)) (sqrt (+ t_0 t_1)))
           (hypot (/ b 2.0) t_1))))
   (if (< b 0.0) (/ (- t_2 (/ b 2.0)) a) (/ (- c) (+ (/ b 2.0) t_2)))))
double code(double a, double b, double c) {
	double t_0 = fabs((b / 2.0));
	double t_1 = sqrt(fabs(a)) * sqrt(fabs(c));
	double tmp;
	if (copysign(a, c) == a) {
		tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1));
	} else {
		tmp = hypot((b / 2.0), t_1);
	}
	double t_2 = tmp;
	double tmp_1;
	if (b < 0.0) {
		tmp_1 = (t_2 - (b / 2.0)) / a;
	} else {
		tmp_1 = -c / ((b / 2.0) + t_2);
	}
	return tmp_1;
}
public static double code(double a, double b, double c) {
	double t_0 = Math.abs((b / 2.0));
	double t_1 = Math.sqrt(Math.abs(a)) * Math.sqrt(Math.abs(c));
	double tmp;
	if (Math.copySign(a, c) == a) {
		tmp = Math.sqrt((t_0 - t_1)) * Math.sqrt((t_0 + t_1));
	} else {
		tmp = Math.hypot((b / 2.0), t_1);
	}
	double t_2 = tmp;
	double tmp_1;
	if (b < 0.0) {
		tmp_1 = (t_2 - (b / 2.0)) / a;
	} else {
		tmp_1 = -c / ((b / 2.0) + t_2);
	}
	return tmp_1;
}
def code(a, b, c):
	t_0 = math.fabs((b / 2.0))
	t_1 = math.sqrt(math.fabs(a)) * math.sqrt(math.fabs(c))
	tmp = 0
	if math.copysign(a, c) == a:
		tmp = math.sqrt((t_0 - t_1)) * math.sqrt((t_0 + t_1))
	else:
		tmp = math.hypot((b / 2.0), t_1)
	t_2 = tmp
	tmp_1 = 0
	if b < 0.0:
		tmp_1 = (t_2 - (b / 2.0)) / a
	else:
		tmp_1 = -c / ((b / 2.0) + t_2)
	return tmp_1
function code(a, b, c)
	t_0 = abs(Float64(b / 2.0))
	t_1 = Float64(sqrt(abs(a)) * sqrt(abs(c)))
	tmp = 0.0
	if (copysign(a, c) == a)
		tmp = Float64(sqrt(Float64(t_0 - t_1)) * sqrt(Float64(t_0 + t_1)));
	else
		tmp = hypot(Float64(b / 2.0), t_1);
	end
	t_2 = tmp
	tmp_1 = 0.0
	if (b < 0.0)
		tmp_1 = Float64(Float64(t_2 - Float64(b / 2.0)) / a);
	else
		tmp_1 = Float64(Float64(-c) / Float64(Float64(b / 2.0) + t_2));
	end
	return tmp_1
end
function tmp_3 = code(a, b, c)
	t_0 = abs((b / 2.0));
	t_1 = sqrt(abs(a)) * sqrt(abs(c));
	tmp = 0.0;
	if ((sign(c) * abs(a)) == a)
		tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1));
	else
		tmp = hypot((b / 2.0), t_1);
	end
	t_2 = tmp;
	tmp_2 = 0.0;
	if (b < 0.0)
		tmp_2 = (t_2 - (b / 2.0)) / a;
	else
		tmp_2 = -c / ((b / 2.0) + t_2);
	end
	tmp_3 = tmp_2;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Abs[N[(b / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[Abs[a], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Abs[c], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = If[Equal[N[With[{TMP1 = Abs[a], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], a], N[(N[Sqrt[N[(t$95$0 - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$0 + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(b / 2.0), $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]]}, If[Less[b, 0.0], N[(N[(t$95$2 - N[(b / 2.0), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[((-c) / N[(N[(b / 2.0), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left|\frac{b}{2}\right|\\
t_1 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\
t_2 := \begin{array}{l}
\mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\
\;\;\;\;\sqrt{t\_0 - t\_1} \cdot \sqrt{t\_0 + t\_1}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(\frac{b}{2}, t\_1\right)\\


\end{array}\\
\mathbf{if}\;b < 0:\\
\;\;\;\;\frac{t\_2 - \frac{b}{2}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{-c}{\frac{b}{2} + t\_2}\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024031 
(FPCore (a b c)
  :name "quadp (p42, positive)"
  :precision binary64
  :herbie-expected 10

  :herbie-target
  (if (< b 0.0) (/ (- (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot (/ b 2.0) (* (sqrt (fabs a)) (sqrt (fabs c))))) (/ b 2.0)) a) (/ (- c) (+ (/ b 2.0) (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot (/ b 2.0) (* (sqrt (fabs a)) (sqrt (fabs c))))))))

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