Cubic critical, medium range

Percentage Accurate: 31.9% → 99.4%
Time: 13.4s
Alternatives: 8
Speedup: 23.2×

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

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

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

Alternative 1: 99.4% accurate, 1.0× speedup?

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

\\
\frac{\frac{c \cdot \left(3 \cdot a\right)}{\left(-b\right) - \sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)}}}{3 \cdot a}
\end{array}
Derivation
  1. Initial program 32.6%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cbrt-cube32.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\frac{c \cdot \left(3 \cdot a\right)}{\left(-b\right) - \sqrt{\color{blue}{b \cdot b} - a \cdot \left(c \cdot 3\right)}}}{3 \cdot a} \]
  14. Add Preprocessing

Alternative 2: 99.1% accurate, 1.0× speedup?

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

\\
\frac{\frac{3 \cdot \left(c \cdot a\right)}{\left(-b\right) - \sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)}}}{3 \cdot a}
\end{array}
Derivation
  1. Initial program 32.6%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cbrt-cube32.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 90.4% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 80.7%

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

    if 0.00104999999999999994 < b

    1. Initial program 29.0%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cbrt-cube29.2%

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

        \[\leadsto \frac{\left(-\color{blue}{\sqrt[3]{b \cdot b} \cdot \sqrt[3]{b}}\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
      3. distribute-rgt-neg-in29.0%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + -0.5 \cdot c}}{b} \]
      2. fma-define92.5%

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

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

        \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot \frac{\color{blue}{c \cdot c}}{{b}^{2}}, -0.5 \cdot c\right)}{b} \]
      5. unpow292.5%

        \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot \frac{c \cdot c}{\color{blue}{b \cdot b}}, -0.5 \cdot c\right)}{b} \]
      6. times-frac92.5%

        \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot \color{blue}{\left(\frac{c}{b} \cdot \frac{c}{b}\right)}, -0.5 \cdot c\right)}{b} \]
      7. unpow192.5%

        \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot \left(\color{blue}{{\left(\frac{c}{b}\right)}^{1}} \cdot \frac{c}{b}\right), -0.5 \cdot c\right)}{b} \]
      8. pow-plus92.5%

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.375, a \cdot {\left(\frac{c}{b}\right)}^{2}, c \cdot -0.5\right)}{b}} \]
    8. Step-by-step derivation
      1. fma-undefine92.5%

        \[\leadsto \frac{\color{blue}{-0.375 \cdot \left(a \cdot {\left(\frac{c}{b}\right)}^{2}\right) + c \cdot -0.5}}{b} \]
    9. Applied egg-rr92.5%

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

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

Alternative 4: 90.7% accurate, 1.0× speedup?

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

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cbrt-cube32.7%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + -0.5 \cdot c}}{b} \]
    2. fma-define90.0%

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

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{2}}}, -0.5 \cdot c\right)}{b} \]
    4. unpow290.0%

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot \frac{\color{blue}{c \cdot c}}{{b}^{2}}, -0.5 \cdot c\right)}{b} \]
    5. unpow290.0%

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot \frac{c \cdot c}{\color{blue}{b \cdot b}}, -0.5 \cdot c\right)}{b} \]
    6. times-frac90.0%

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot \color{blue}{\left(\frac{c}{b} \cdot \frac{c}{b}\right)}, -0.5 \cdot c\right)}{b} \]
    7. unpow190.0%

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot \left(\color{blue}{{\left(\frac{c}{b}\right)}^{1}} \cdot \frac{c}{b}\right), -0.5 \cdot c\right)}{b} \]
    8. pow-plus90.0%

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

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot {\left(\frac{c}{b}\right)}^{\color{blue}{2}}, -0.5 \cdot c\right)}{b} \]
    10. *-commutative90.0%

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot {\left(\frac{c}{b}\right)}^{2}, \color{blue}{c \cdot -0.5}\right)}{b} \]
  7. Simplified90.0%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.375, a \cdot {\left(\frac{c}{b}\right)}^{2}, c \cdot -0.5\right)}{b}} \]
  8. Step-by-step derivation
    1. fma-undefine90.0%

      \[\leadsto \frac{\color{blue}{-0.375 \cdot \left(a \cdot {\left(\frac{c}{b}\right)}^{2}\right) + c \cdot -0.5}}{b} \]
  9. Applied egg-rr90.0%

    \[\leadsto \frac{\color{blue}{-0.375 \cdot \left(a \cdot {\left(\frac{c}{b}\right)}^{2}\right) + c \cdot -0.5}}{b} \]
  10. Add Preprocessing

Alternative 5: 90.7% accurate, 1.0× speedup?

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

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cbrt-cube32.7%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + -0.5 \cdot c}}{b} \]
    2. fma-define90.0%

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

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{2}}}, -0.5 \cdot c\right)}{b} \]
    4. unpow290.0%

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot \frac{\color{blue}{c \cdot c}}{{b}^{2}}, -0.5 \cdot c\right)}{b} \]
    5. unpow290.0%

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot \frac{c \cdot c}{\color{blue}{b \cdot b}}, -0.5 \cdot c\right)}{b} \]
    6. times-frac90.0%

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot \color{blue}{\left(\frac{c}{b} \cdot \frac{c}{b}\right)}, -0.5 \cdot c\right)}{b} \]
    7. unpow190.0%

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot \left(\color{blue}{{\left(\frac{c}{b}\right)}^{1}} \cdot \frac{c}{b}\right), -0.5 \cdot c\right)}{b} \]
    8. pow-plus90.0%

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

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot {\left(\frac{c}{b}\right)}^{\color{blue}{2}}, -0.5 \cdot c\right)}{b} \]
    10. *-commutative90.0%

      \[\leadsto \frac{\mathsf{fma}\left(-0.375, a \cdot {\left(\frac{c}{b}\right)}^{2}, \color{blue}{c \cdot -0.5}\right)}{b} \]
  7. Simplified90.0%

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

    \[\leadsto \frac{\color{blue}{c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{2}} - 0.5\right)}}{b} \]
  9. Final simplification90.0%

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

Alternative 6: 90.5% accurate, 1.0× speedup?

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

\\
c \cdot \left(-0.375 \cdot \frac{c \cdot a}{{b}^{3}} - \frac{0.5}{b}\right)
\end{array}
Derivation
  1. Initial program 32.6%

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

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

      \[\leadsto \color{blue}{c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - 0.5 \cdot \frac{1}{b}\right)} \]
    4. Step-by-step derivation
      1. associate-*r/89.7%

        \[\leadsto c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - \color{blue}{\frac{0.5 \cdot 1}{b}}\right) \]
      2. metadata-eval89.7%

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

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

      \[\leadsto c \cdot \left(-0.375 \cdot \frac{c \cdot a}{{b}^{3}} - \frac{0.5}{b}\right) \]
    7. Add Preprocessing

    Alternative 7: 81.0% accurate, 23.2× speedup?

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

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

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

        \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
      4. Final simplification80.2%

        \[\leadsto \frac{c}{b} \cdot -0.5 \]
      5. Add Preprocessing

      Alternative 8: 3.2% accurate, 38.7× speedup?

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

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. add-cbrt-cube32.7%

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot \left(b + -1 \cdot b\right)}{a}} \]
        2. distribute-rgt1-in3.2%

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

          \[\leadsto \frac{0.3333333333333333 \cdot \left(\color{blue}{0} \cdot b\right)}{a} \]
        4. mul0-lft3.2%

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

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

        \[\leadsto \color{blue}{\frac{0}{a}} \]
      8. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 2024170 
      (FPCore (a b c)
        :name "Cubic critical, 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) (* (* 3.0 a) c)))) (* 3.0 a)))