Quadratic roots, medium range

Percentage Accurate: 30.9% → 99.8%
Time: 9.8s
Alternatives: 6
Speedup: 29.0×

Specification

?
\[\left(\left(1.1102230246251565 \cdot 10^{-16} < a \land a < 9007199254740992\right) \land \left(1.1102230246251565 \cdot 10^{-16} < b \land b < 9007199254740992\right)\right) \land \left(1.1102230246251565 \cdot 10^{-16} < c \land c < 9007199254740992\right)\]
\[\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 6 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: 30.9% 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: 99.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \frac{0.5 \cdot \left(4 \cdot c\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \left(-4\right)\right)\right)}} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (* 0.5 (* 4.0 c)) (- (- b) (sqrt (fma b b (* c (* a (- 4.0))))))))
double code(double a, double b, double c) {
	return (0.5 * (4.0 * c)) / (-b - sqrt(fma(b, b, (c * (a * -4.0)))));
}
function code(a, b, c)
	return Float64(Float64(0.5 * Float64(4.0 * c)) / Float64(Float64(-b) - sqrt(fma(b, b, Float64(c * Float64(a * Float64(-4.0)))))))
end
code[a_, b_, c_] := N[(N[(0.5 * N[(4.0 * c), $MachinePrecision]), $MachinePrecision] / N[((-b) - N[Sqrt[N[(b * b + N[(c * N[(a * (-4.0)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{0.5 \cdot \left(4 \cdot c\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \left(-4\right)\right)\right)}}
\end{array}
Derivation
  1. Initial program 33.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{0.5 \cdot \color{blue}{\left(4 \cdot c\right)}}{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-a \cdot 4\right)\right)}} \]
  9. Final simplification99.7%

    \[\leadsto \frac{0.5 \cdot \left(4 \cdot c\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \left(-4\right)\right)\right)}} \]

Alternative 2: 90.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2} \leq -1:\\
\;\;\;\;\frac{\sqrt{b \cdot b + -4 \cdot \left(c \cdot a\right)} - b}{a \cdot 2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) < -1

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))

    1. Initial program 26.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. flip-+26.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2} \leq -1:\\ \;\;\;\;\frac{\sqrt{b \cdot b + -4 \cdot \left(c \cdot a\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5 \cdot \left(4 \cdot c\right)}{2 \cdot \frac{c \cdot a}{b} + b \cdot -2}\\ \end{array} \]

Alternative 3: 99.8% accurate, 1.0× speedup?

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

\\
\frac{0.5 \cdot \left(4 \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}
\end{array}
Derivation
  1. Initial program 33.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{0.5 \cdot \left(4 \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b + c \cdot \left(a \cdot \color{blue}{-4}\right)}} \]
  10. Applied egg-rr99.7%

    \[\leadsto \frac{0.5 \cdot \left(4 \cdot c\right)}{\left(-b\right) - \sqrt{\color{blue}{b \cdot b + c \cdot \left(a \cdot -4\right)}}} \]
  11. Final simplification99.7%

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

Alternative 4: 91.3% accurate, 6.8× speedup?

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

\\
\frac{0.5 \cdot \left(4 \cdot c\right)}{2 \cdot \frac{c \cdot a}{b} + b \cdot -2}
\end{array}
Derivation
  1. Initial program 33.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{0.5 \cdot \left(4 \cdot c\right)}{2 \cdot \frac{c \cdot a}{b} + b \cdot -2} \]

Alternative 5: 81.7% accurate, 29.0× 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(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 33.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{-c}{b} \]

Alternative 6: 3.2% accurate, 38.7× speedup?

\[\begin{array}{l} \\ \frac{0}{a} \end{array} \]
(FPCore (a b c) :precision binary64 (/ 0.0 a))
double code(double a, double b, double c) {
	return 0.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 = 0.0d0 / a
end function
public static double code(double a, double b, double c) {
	return 0.0 / a;
}
def code(a, b, c):
	return 0.0 / a
function code(a, b, c)
	return Float64(0.0 / a)
end
function tmp = code(a, b, c)
	tmp = 0.0 / a;
end
code[a_, b_, c_] := N[(0.0 / a), $MachinePrecision]
\begin{array}{l}

\\
\frac{0}{a}
\end{array}
Derivation
  1. Initial program 33.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{0.5 \cdot \left(\frac{b + -1 \cdot b}{a} \cdot {1}^{0.3333333333333333}\right)} \]
  5. Step-by-step derivation
    1. pow-base-13.2%

      \[\leadsto 0.5 \cdot \left(\frac{b + -1 \cdot b}{a} \cdot \color{blue}{1}\right) \]
    2. *-rgt-identity3.2%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{b + -1 \cdot b}{a}} \]
    3. associate-*r/3.2%

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(b + -1 \cdot b\right)}{a}} \]
    4. neg-mul-13.2%

      \[\leadsto \frac{0.5 \cdot \left(b + \color{blue}{\left(-b\right)}\right)}{a} \]
    5. sub-neg3.2%

      \[\leadsto \frac{0.5 \cdot \color{blue}{\left(b - b\right)}}{a} \]
    6. +-inverses3.2%

      \[\leadsto \frac{0.5 \cdot \color{blue}{0}}{a} \]
    7. metadata-eval3.2%

      \[\leadsto \frac{\color{blue}{0}}{a} \]
  6. Simplified3.2%

    \[\leadsto \color{blue}{\frac{0}{a}} \]
  7. Final simplification3.2%

    \[\leadsto \frac{0}{a} \]

Reproduce

?
herbie shell --seed 2023250 
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :precision binary64
  :pre (and (and (and (< 1.1102230246251565e-16 a) (< a 9007199254740992.0)) (and (< 1.1102230246251565e-16 b) (< b 9007199254740992.0))) (and (< 1.1102230246251565e-16 c) (< c 9007199254740992.0)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))