Quadratic roots, wide range

Percentage Accurate: 17.6% → 99.6%
Time: 9.6s
Alternatives: 5
Speedup: 29.0×

Specification

?
\[\left(\left(4.930380657631324 \cdot 10^{-32} < a \land a < 2.028240960365167 \cdot 10^{+31}\right) \land \left(4.930380657631324 \cdot 10^{-32} < b \land b < 2.028240960365167 \cdot 10^{+31}\right)\right) \land \left(4.930380657631324 \cdot 10^{-32} < c \land c < 2.028240960365167 \cdot 10^{+31}\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 5 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: 17.6% 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.6% accurate, 0.4× speedup?

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

\\
\frac{c}{\frac{b + \sqrt[3]{{\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{1.5}}}{\frac{a \cdot -2}{a}}}
\end{array}
Derivation
  1. Initial program 18.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. /-rgt-identity18.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{b \cdot b + \color{blue}{\left(-4\right)} \cdot \left(a \cdot c\right)} - b\right) \cdot \frac{0.5}{a} \]
    4. cancel-sign-sub-inv18.3%

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

      \[\leadsto \left(\sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}} - b\right) \cdot \frac{0.5}{a} \]
    6. add-cbrt-cube18.4%

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

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

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

      \[\leadsto \left(\sqrt[3]{{\left(b \cdot b - \color{blue}{4 \cdot \left(a \cdot c\right)}\right)}^{\left(\frac{3}{2}\right)}} - b\right) \cdot \frac{0.5}{a} \]
    10. cancel-sign-sub-inv18.3%

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

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

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

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

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

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

    \[\leadsto \left(\color{blue}{\sqrt[3]{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)\right)}^{1.5}}} - b\right) \cdot \frac{0.5}{a} \]
  6. Step-by-step derivation
    1. flip--18.3%

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

    \[\leadsto \color{blue}{\frac{\sqrt[3]{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)\right)}^{1.5}} \cdot \sqrt[3]{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)\right)}^{1.5}} - b \cdot b}{\sqrt[3]{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)\right)}^{1.5}} + b}} \cdot \frac{0.5}{a} \]
  8. Step-by-step derivation
    1. fma-neg19.4%

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{c \cdot \left(a \cdot -4\right)}}{b + \sqrt[3]{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)\right)}^{1.5}}} \cdot \frac{0.5}{a} \]
  13. Step-by-step derivation
    1. expm1-log1p-u82.5%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{c \cdot \left(a \cdot -4\right)}{b + \sqrt[3]{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)\right)}^{1.5}}} \cdot \frac{0.5}{a}\right)} - 1} \]
    3. frac-times19.1%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{\left(c \cdot \left(a \cdot -4\right)\right) \cdot 0.5}{\left(b + \sqrt[3]{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)\right)}^{1.5}}\right) \cdot a}}\right)} - 1 \]
    4. associate-*r*19.1%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\left(c \cdot \left(a \cdot -4\right)\right) \cdot 0.5}{\left(b + \sqrt[3]{{\left(\mathsf{fma}\left(b, b, \color{blue}{\left(a \cdot c\right) \cdot -4}\right)\right)}^{1.5}}\right) \cdot a}\right)} - 1 \]
    5. *-commutative19.1%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\left(c \cdot \left(a \cdot -4\right)\right) \cdot 0.5}{\left(b + \sqrt[3]{{\left(\mathsf{fma}\left(b, b, \color{blue}{\left(c \cdot a\right)} \cdot -4\right)\right)}^{1.5}}\right) \cdot a}\right)} - 1 \]
    6. associate-*r*19.1%

      \[\leadsto e^{\mathsf{log1p}\left(\frac{\left(c \cdot \left(a \cdot -4\right)\right) \cdot 0.5}{\left(b + \sqrt[3]{{\left(\mathsf{fma}\left(b, b, \color{blue}{c \cdot \left(a \cdot -4\right)}\right)\right)}^{1.5}}\right) \cdot a}\right)} - 1 \]
  14. Applied egg-rr19.1%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\left(c \cdot \left(a \cdot -4\right)\right) \cdot 0.5}{\left(b + \sqrt[3]{{\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{1.5}}\right) \cdot a}\right)} - 1} \]
  15. Step-by-step derivation
    1. expm1-def82.5%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(c \cdot \left(a \cdot -4\right)\right) \cdot 0.5}{\left(b + \sqrt[3]{{\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{1.5}}\right) \cdot a}\right)\right)} \]
    2. expm1-log1p99.2%

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{c}{\frac{b + \sqrt[3]{{\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{1.5}}}{\frac{a \cdot -2}{a}}} \]

Alternative 2: 97.0% accurate, 0.5× speedup?

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

\\
\left(\frac{-2 \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot a\right)\right)\right)}{{b}^{5}} - \frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}}
\end{array}
Derivation
  1. Initial program 18.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. /-rgt-identity18.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)} \]
  5. Step-by-step derivation
    1. +-commutative97.6%

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
    2. mul-1-neg97.6%

      \[\leadsto \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + \color{blue}{\left(-\frac{{c}^{2} \cdot a}{{b}^{3}}\right)} \]
    3. unsub-neg97.6%

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

    \[\leadsto \color{blue}{\left(\frac{-2 \cdot \left(c \cdot {\left(c \cdot a\right)}^{2}\right)}{{b}^{5}} - \frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}}} \]
  7. Step-by-step derivation
    1. unpow-prod-down97.6%

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

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

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

    \[\leadsto \left(\frac{-2 \cdot \left(c \cdot \color{blue}{\left(\left(c \cdot c\right) \cdot \left(a \cdot a\right)\right)}\right)}{{b}^{5}} - \frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}} \]
  9. Final simplification97.6%

    \[\leadsto \left(\frac{-2 \cdot \left(c \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot a\right)\right)\right)}{{b}^{5}} - \frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}} \]

Alternative 3: 95.3% accurate, 1.0× speedup?

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

\\
\left(-\frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}}
\end{array}
Derivation
  1. Initial program 18.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. /-rgt-identity18.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -1 \cdot \frac{c}{b}} \]
  5. Step-by-step derivation
    1. +-commutative95.8%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
    4. mul-1-neg95.8%

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

      \[\leadsto \left(-\frac{c}{b}\right) - \color{blue}{\frac{{c}^{2}}{\frac{{b}^{3}}{a}}} \]
    6. unpow295.8%

      \[\leadsto \left(-\frac{c}{b}\right) - \frac{\color{blue}{c \cdot c}}{\frac{{b}^{3}}{a}} \]
  6. Simplified95.8%

    \[\leadsto \color{blue}{\left(-\frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}}} \]
  7. Final simplification95.8%

    \[\leadsto \left(-\frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}} \]

Alternative 4: 95.0% accurate, 5.5× speedup?

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

\\
\frac{c \cdot \left(a \cdot -4\right)}{b + \left(b + -2 \cdot \frac{c \cdot a}{b}\right)} \cdot \frac{0.5}{a}
\end{array}
Derivation
  1. Initial program 18.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. /-rgt-identity18.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{b \cdot b + \color{blue}{\left(-4\right)} \cdot \left(a \cdot c\right)} - b\right) \cdot \frac{0.5}{a} \]
    4. cancel-sign-sub-inv18.3%

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

      \[\leadsto \left(\sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}} - b\right) \cdot \frac{0.5}{a} \]
    6. add-cbrt-cube18.4%

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

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

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

      \[\leadsto \left(\sqrt[3]{{\left(b \cdot b - \color{blue}{4 \cdot \left(a \cdot c\right)}\right)}^{\left(\frac{3}{2}\right)}} - b\right) \cdot \frac{0.5}{a} \]
    10. cancel-sign-sub-inv18.3%

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

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

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

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

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

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

    \[\leadsto \left(\color{blue}{\sqrt[3]{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)\right)}^{1.5}}} - b\right) \cdot \frac{0.5}{a} \]
  6. Step-by-step derivation
    1. flip--18.3%

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

    \[\leadsto \color{blue}{\frac{\sqrt[3]{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)\right)}^{1.5}} \cdot \sqrt[3]{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)\right)}^{1.5}} - b \cdot b}{\sqrt[3]{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)\right)}^{1.5}} + b}} \cdot \frac{0.5}{a} \]
  8. Step-by-step derivation
    1. fma-neg19.4%

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

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

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

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

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

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

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

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

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

Alternative 5: 90.5% 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 18.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. /-rgt-identity18.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\frac{c}{b}} \]
  6. Simplified90.1%

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

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

Reproduce

?
herbie shell --seed 2023238 
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :precision binary64
  :pre (and (and (and (< 4.930380657631324e-32 a) (< a 2.028240960365167e+31)) (and (< 4.930380657631324e-32 b) (< b 2.028240960365167e+31))) (and (< 4.930380657631324e-32 c) (< c 2.028240960365167e+31)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))