Quadratic roots, medium range

Percentage Accurate: 31.9% → 99.4%
Time: 16.4s
Alternatives: 8
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 8 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.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.4% accurate, 0.5× speedup?

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

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

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

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

    \[\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-cbrt-cube34.5%

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

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

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

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

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

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

    \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
  7. Step-by-step derivation
    1. unpow1/334.1%

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left(\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c\right)}{\left(-b\right) - \sqrt{\sqrt[3]{{b}^{6}} - \left(4 \cdot a\right) \cdot c}}}{a \cdot 2} \]
    5. pow-pow35.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 89.7% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 74.7%

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

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

      \[\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-cbrt-cube74.1%

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    7. Step-by-step derivation
      1. unpow1/373.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.058999999999999997 < b

    1. Initial program 25.4%

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

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

      \[\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-cbrt-cube25.4%

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    7. Step-by-step derivation
      1. unpow1/325.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.059:\\ \;\;\;\;\frac{1}{2 \cdot \frac{a}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{c \cdot a}{b} - b}{c}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.3% accurate, 0.5× speedup?

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

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

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

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

    \[\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-cbrt-cube34.5%

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

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

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

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

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

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

    \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
  7. Step-by-step derivation
    1. unpow1/334.1%

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

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

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left(\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c\right)}{\left(-b\right) - \sqrt{\sqrt[3]{{b}^{6}} - \left(4 \cdot a\right) \cdot c}}}{a \cdot 2} \]
    5. pow-pow35.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 89.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 0.059:\\ \;\;\;\;\frac{0.5}{a} \cdot \left(\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{c \cdot a}{b} - b}{c}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 0.059)
   (* (/ 0.5 a) (- (sqrt (fma b b (* a (* c -4.0)))) b))
   (/ 1.0 (/ (- (/ (* c a) b) b) c))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 0.059) {
		tmp = (0.5 / a) * (sqrt(fma(b, b, (a * (c * -4.0)))) - b);
	} else {
		tmp = 1.0 / ((((c * a) / b) - b) / c);
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= 0.059)
		tmp = Float64(Float64(0.5 / a) * Float64(sqrt(fma(b, b, Float64(a * Float64(c * -4.0)))) - b));
	else
		tmp = Float64(1.0 / Float64(Float64(Float64(Float64(c * a) / b) - b) / c));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 0.059], N[(N[(0.5 / a), $MachinePrecision] * N[(N[Sqrt[N[(b * b + N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision] - b), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.059:\\
\;\;\;\;\frac{0.5}{a} \cdot \left(\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b\right)\\

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


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

    1. Initial program 74.7%

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

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

      \[\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-cbrt-cube74.1%

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    7. Step-by-step derivation
      1. unpow1/373.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.058999999999999997 < b

    1. Initial program 25.4%

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

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

      \[\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-cbrt-cube25.4%

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    7. Step-by-step derivation
      1. unpow1/325.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.059:\\ \;\;\;\;\frac{0.5}{a} \cdot \left(\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{c \cdot a}{b} - b}{c}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 89.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 74.7%

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

    if 0.058999999999999997 < b

    1. Initial program 25.4%

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

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

      \[\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-cbrt-cube25.4%

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
    7. Step-by-step derivation
      1. unpow1/325.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 90.7% accurate, 10.5× speedup?

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

\\
\frac{1}{\frac{\frac{c \cdot a}{b} - b}{c}}
\end{array}
Derivation
  1. Initial program 34.7%

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

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

    \[\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-cbrt-cube34.5%

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

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

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

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

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

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

    \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
  7. Step-by-step derivation
    1. unpow1/334.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{\frac{-1 \cdot b + \frac{a \cdot c}{b}}{c}}} \]
  16. Final simplification88.5%

    \[\leadsto \frac{1}{\frac{\frac{c \cdot a}{b} - b}{c}} \]
  17. Add Preprocessing

Alternative 7: 90.7% accurate, 12.9× speedup?

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

\\
\frac{1}{\frac{a}{b} - \frac{b}{c}}
\end{array}
Derivation
  1. Initial program 34.7%

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

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

    \[\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-cbrt-cube34.5%

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

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

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

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

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

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

    \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - \left(4 \cdot a\right) \cdot c}}{a \cdot 2} \]
  7. Step-by-step derivation
    1. unpow1/334.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + \frac{a}{b}}} \]
  16. Final simplification88.5%

    \[\leadsto \frac{1}{\frac{a}{b} - \frac{b}{c}} \]
  17. Add Preprocessing

Alternative 8: 80.9% 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 34.7%

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

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

    \[\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. Taylor expanded in b around inf 78.7%

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

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

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

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

Reproduce

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