Quadratic roots, medium range

Percentage Accurate: 31.8% → 99.7%
Time: 14.2s
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: 31.8% 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.7% accurate, 0.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \color{blue}{c \cdot e^{\log \left(4 \cdot a\right)}}\right)}{\left(-b\right) - \sqrt{b \cdot b - e^{\log \left(4 \cdot a\right)} \cdot c}}}{a \cdot 2} \]
    6. rem-exp-log34.5%

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - c \cdot \left(a \cdot 4\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{c \cdot e^{\log \left(4 \cdot a\right)}}}}}{a \cdot 2} \]
    10. rem-exp-log34.5%

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

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

    \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - c \cdot \left(a \cdot 4\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - c \cdot \left(a \cdot 4\right)}}}}{a \cdot 2} \]
  9. Step-by-step derivation
    1. *-un-lft-identity34.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{0 + c \cdot \left(a \cdot 4\right)}{a \cdot 2}}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{4 \cdot \left(a \cdot c\right)}}} \]
    8. cancel-sign-sub-inv99.6%

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

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

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

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

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

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

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

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

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

Alternative 2: 99.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(a \cdot 4\right)\\ \frac{\frac{t\_0}{\left(-b\right) - \sqrt{{b}^{2} - t\_0}}}{2 \cdot a} \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* c (* a 4.0))))
   (/ (/ t_0 (- (- b) (sqrt (- (pow b 2.0) t_0)))) (* 2.0 a))))
double code(double a, double b, double c) {
	double t_0 = c * (a * 4.0);
	return (t_0 / (-b - sqrt((pow(b, 2.0) - t_0)))) / (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
    real(8) :: t_0
    t_0 = c * (a * 4.0d0)
    code = (t_0 / (-b - sqrt(((b ** 2.0d0) - t_0)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
	double t_0 = c * (a * 4.0);
	return (t_0 / (-b - Math.sqrt((Math.pow(b, 2.0) - t_0)))) / (2.0 * a);
}
def code(a, b, c):
	t_0 = c * (a * 4.0)
	return (t_0 / (-b - math.sqrt((math.pow(b, 2.0) - t_0)))) / (2.0 * a)
function code(a, b, c)
	t_0 = Float64(c * Float64(a * 4.0))
	return Float64(Float64(t_0 / Float64(Float64(-b) - sqrt(Float64((b ^ 2.0) - t_0)))) / Float64(2.0 * a))
end
function tmp = code(a, b, c)
	t_0 = c * (a * 4.0);
	tmp = (t_0 / (-b - sqrt(((b ^ 2.0) - t_0)))) / (2.0 * a);
end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$0 / N[((-b) - N[Sqrt[N[(N[Power[b, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := c \cdot \left(a \cdot 4\right)\\
\frac{\frac{t\_0}{\left(-b\right) - \sqrt{{b}^{2} - t\_0}}}{2 \cdot a}
\end{array}
\end{array}
Derivation
  1. Initial program 33.5%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \color{blue}{c \cdot e^{\log \left(4 \cdot a\right)}}\right)}{\left(-b\right) - \sqrt{b \cdot b - e^{\log \left(4 \cdot a\right)} \cdot c}}}{a \cdot 2} \]
    6. rem-exp-log34.5%

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - c \cdot \left(a \cdot 4\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{c \cdot e^{\log \left(4 \cdot a\right)}}}}}{a \cdot 2} \]
    10. rem-exp-log34.5%

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

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

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

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

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

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

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

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

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

Alternative 3: 99.6% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \color{blue}{c \cdot e^{\log \left(4 \cdot a\right)}}\right)}{\left(-b\right) - \sqrt{b \cdot b - e^{\log \left(4 \cdot a\right)} \cdot c}}}{a \cdot 2} \]
    6. rem-exp-log34.5%

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - c \cdot \left(a \cdot 4\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{c \cdot e^{\log \left(4 \cdot a\right)}}}}}{a \cdot 2} \]
    10. rem-exp-log34.5%

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

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

    \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - c \cdot \left(a \cdot 4\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - c \cdot \left(a \cdot 4\right)}}}}{a \cdot 2} \]
  9. Step-by-step derivation
    1. *-un-lft-identity34.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{0 + c \cdot \left(a \cdot 4\right)}{a \cdot 2}}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{4 \cdot \left(a \cdot c\right)}}} \]
    8. cancel-sign-sub-inv99.6%

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

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

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

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

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

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

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

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

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

Alternative 4: 90.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\frac{c \cdot \left(a \cdot 4\right)}{2 \cdot a}}{b \cdot \left(2 \cdot \frac{c \cdot a}{{b}^{2}} - 2\right)} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/
  (/ (* c (* a 4.0)) (* 2.0 a))
  (* b (- (* 2.0 (/ (* c a) (pow b 2.0))) 2.0))))
double code(double a, double b, double c) {
	return ((c * (a * 4.0)) / (2.0 * a)) / (b * ((2.0 * ((c * a) / pow(b, 2.0))) - 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 = ((c * (a * 4.0d0)) / (2.0d0 * a)) / (b * ((2.0d0 * ((c * a) / (b ** 2.0d0))) - 2.0d0))
end function
public static double code(double a, double b, double c) {
	return ((c * (a * 4.0)) / (2.0 * a)) / (b * ((2.0 * ((c * a) / Math.pow(b, 2.0))) - 2.0));
}
def code(a, b, c):
	return ((c * (a * 4.0)) / (2.0 * a)) / (b * ((2.0 * ((c * a) / math.pow(b, 2.0))) - 2.0))
function code(a, b, c)
	return Float64(Float64(Float64(c * Float64(a * 4.0)) / Float64(2.0 * a)) / Float64(b * Float64(Float64(2.0 * Float64(Float64(c * a) / (b ^ 2.0))) - 2.0)))
end
function tmp = code(a, b, c)
	tmp = ((c * (a * 4.0)) / (2.0 * a)) / (b * ((2.0 * ((c * a) / (b ^ 2.0))) - 2.0));
end
code[a_, b_, c_] := N[(N[(N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] / N[(b * N[(N[(2.0 * N[(N[(c * a), $MachinePrecision] / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \color{blue}{c \cdot e^{\log \left(4 \cdot a\right)}}\right)}{\left(-b\right) - \sqrt{b \cdot b - e^{\log \left(4 \cdot a\right)} \cdot c}}}{a \cdot 2} \]
    6. rem-exp-log34.5%

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - c \cdot \left(a \cdot 4\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{c \cdot e^{\log \left(4 \cdot a\right)}}}}}{a \cdot 2} \]
    10. rem-exp-log34.5%

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

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

    \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - c \cdot \left(a \cdot 4\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - c \cdot \left(a \cdot 4\right)}}}}{a \cdot 2} \]
  9. Step-by-step derivation
    1. *-un-lft-identity34.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{0 + c \cdot \left(a \cdot 4\right)}{a \cdot 2}}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{4 \cdot \left(a \cdot c\right)}}} \]
    8. cancel-sign-sub-inv99.6%

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

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

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

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

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

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

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

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

Alternative 5: 90.9% accurate, 6.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \color{blue}{c \cdot e^{\log \left(4 \cdot a\right)}}\right)}{\left(-b\right) - \sqrt{b \cdot b - e^{\log \left(4 \cdot a\right)} \cdot c}}}{a \cdot 2} \]
    6. rem-exp-log34.5%

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - c \cdot \left(a \cdot 4\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{c \cdot e^{\log \left(4 \cdot a\right)}}}}}{a \cdot 2} \]
    10. rem-exp-log34.5%

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

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

    \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - c \cdot \left(a \cdot 4\right)\right)}{\left(-b\right) - \sqrt{{b}^{2} - c \cdot \left(a \cdot 4\right)}}}}{a \cdot 2} \]
  9. Step-by-step derivation
    1. *-un-lft-identity34.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{0 + c \cdot \left(a \cdot 4\right)}{a \cdot 2}}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{4 \cdot \left(a \cdot c\right)}}} \]
    8. cancel-sign-sub-inv99.6%

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

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

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

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

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

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

    \[\leadsto \frac{\frac{0 + c \cdot \left(a \cdot 4\right)}{a \cdot 2}}{\color{blue}{2 \cdot \frac{a \cdot c}{b} - 2 \cdot b}} \]
  14. Step-by-step derivation
    1. distribute-lft-out--88.9%

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

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

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

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

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

Alternative 6: 81.0% 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(c / Float64(-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.5%

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

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

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

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

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

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

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

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

Reproduce

?
herbie shell --seed 2024172 
(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)))