Cubic critical, medium range

Percentage Accurate: 31.4% → 99.1%
Time: 22.4s
Alternatives: 7
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 7 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.4% 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.1% accurate, 0.5× speedup?

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

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Applied egg-rr33.9%

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\mathsf{fma}\left(-6, a \cdot \left(c \cdot \left(b \cdot b\right)\right), 9 \cdot \left(\left(a \cdot a\right) \cdot \color{blue}{\left(c \cdot c\right)}\right)\right) \cdot \frac{1}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}}}{\mathsf{fma}\left(b, b, \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)\right)}}{3 \cdot a} \]
    6. unswap-sqr98.9%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(a \cdot \left(c \cdot -3\right)\right)} \cdot \frac{\frac{1}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)}}}{a \cdot 3} \]
  10. Final simplification99.1%

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

Alternative 2: 99.1% accurate, 0.5× speedup?

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

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Applied egg-rr33.9%

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\mathsf{fma}\left(-6, a \cdot \left(c \cdot \left(b \cdot b\right)\right), 9 \cdot \left(\left(a \cdot a\right) \cdot \color{blue}{\left(c \cdot c\right)}\right)\right) \cdot \frac{1}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}}}{\mathsf{fma}\left(b, b, \mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)\right)}}{3 \cdot a} \]
    6. unswap-sqr98.9%

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

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

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

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

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

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

Alternative 3: 93.7% accurate, 0.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\frac{1}{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{-3 \cdot \left(a \cdot c\right)}\right)}}} - b}{\frac{a}{0.3333333333333333}} \]
    7. associate-*l*32.2%

      \[\leadsto \frac{\frac{1}{\frac{1}{\sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(3 \cdot a\right) \cdot c}\right)}}} - b}{\frac{a}{0.3333333333333333}} \]
    8. distribute-lft-neg-in32.2%

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

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

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

      \[\leadsto \frac{\frac{1}{\frac{1}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-3\right)\right)}\right)}}} - b}{\frac{a}{0.3333333333333333}} \]
    12. metadata-eval32.2%

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

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

    \[\leadsto \frac{\color{blue}{\frac{1}{\frac{1}{\sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b}}}}{\frac{a}{0.3333333333333333}} \]
  7. Taylor expanded in b around inf 94.5%

    \[\leadsto \frac{\frac{1}{\color{blue}{-1 \cdot \frac{-0.75 \cdot \left(a \cdot c\right) + 0.375 \cdot \left(a \cdot c\right)}{{b}^{3}} + \left(-0.6666666666666666 \cdot \frac{b}{a \cdot c} + 0.5 \cdot \frac{1}{b}\right)}}}{\frac{a}{0.3333333333333333}} \]
  8. Final simplification94.5%

    \[\leadsto \frac{\frac{1}{\left(-0.6666666666666666 \cdot \frac{b}{a \cdot c} + 0.5 \cdot \frac{1}{b}\right) - \frac{\left(a \cdot c\right) \cdot -0.75 + \left(a \cdot c\right) \cdot 0.375}{{b}^{3}}}}{\frac{a}{0.3333333333333333}} \]

Alternative 4: 90.7% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\frac{1}{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{-3 \cdot \left(a \cdot c\right)}\right)}}} - b}{\frac{a}{0.3333333333333333}} \]
    7. associate-*l*32.2%

      \[\leadsto \frac{\frac{1}{\frac{1}{\sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(3 \cdot a\right) \cdot c}\right)}}} - b}{\frac{a}{0.3333333333333333}} \]
    8. distribute-lft-neg-in32.2%

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

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

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

      \[\leadsto \frac{\frac{1}{\frac{1}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-3\right)\right)}\right)}}} - b}{\frac{a}{0.3333333333333333}} \]
    12. metadata-eval32.2%

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

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

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

    \[\leadsto \frac{\frac{1}{\color{blue}{-0.6666666666666666 \cdot \frac{b}{a \cdot c} + 0.5 \cdot \frac{1}{b}}}}{\frac{a}{0.3333333333333333}} \]
  8. Step-by-step derivation
    1. fma-def91.3%

      \[\leadsto \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a \cdot c}, 0.5 \cdot \frac{1}{b}\right)}}}{\frac{a}{0.3333333333333333}} \]
    2. associate-*r/91.3%

      \[\leadsto \frac{\frac{1}{\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a \cdot c}, \color{blue}{\frac{0.5 \cdot 1}{b}}\right)}}{\frac{a}{0.3333333333333333}} \]
    3. metadata-eval91.3%

      \[\leadsto \frac{\frac{1}{\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a \cdot c}, \frac{\color{blue}{0.5}}{b}\right)}}{\frac{a}{0.3333333333333333}} \]
  9. Simplified91.3%

    \[\leadsto \frac{\frac{1}{\color{blue}{\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a \cdot c}, \frac{0.5}{b}\right)}}}{\frac{a}{0.3333333333333333}} \]
  10. Final simplification91.3%

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

Alternative 5: 90.7% accurate, 6.1× speedup?

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

\\
\frac{\frac{1}{-0.6666666666666666 \cdot \frac{b}{a \cdot c} + 0.5 \cdot \frac{1}{b}}}{\frac{a}{0.3333333333333333}}
\end{array}
Derivation
  1. Initial program 32.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\frac{1}{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{-3 \cdot \left(a \cdot c\right)}\right)}}} - b}{\frac{a}{0.3333333333333333}} \]
    7. associate-*l*32.2%

      \[\leadsto \frac{\frac{1}{\frac{1}{\sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(3 \cdot a\right) \cdot c}\right)}}} - b}{\frac{a}{0.3333333333333333}} \]
    8. distribute-lft-neg-in32.2%

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

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

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

      \[\leadsto \frac{\frac{1}{\frac{1}{\sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-3\right)\right)}\right)}}} - b}{\frac{a}{0.3333333333333333}} \]
    12. metadata-eval32.2%

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

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

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

    \[\leadsto \frac{\frac{1}{\color{blue}{-0.6666666666666666 \cdot \frac{b}{a \cdot c} + 0.5 \cdot \frac{1}{b}}}}{\frac{a}{0.3333333333333333}} \]
  8. Final simplification91.3%

    \[\leadsto \frac{\frac{1}{-0.6666666666666666 \cdot \frac{b}{a \cdot c} + 0.5 \cdot \frac{1}{b}}}{\frac{a}{0.3333333333333333}} \]

Alternative 6: 81.3% accurate, 23.2× speedup?

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

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Taylor expanded in b around inf 80.6%

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

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

Alternative 7: 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.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Applied egg-rr31.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\left(a \cdot 3\right) \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)} - b \cdot \left(a \cdot 3\right)\right) \cdot \frac{1}{{\left(\frac{0.3333333333333333}{a}\right)}^{-2}}} \]
  5. Step-by-step derivation
    1. cancel-sign-sub-inv31.7%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.1111111111111111 \cdot \left(-3 \cdot b + 3 \cdot b\right)}{a}} \]
    2. distribute-rgt-out3.2%

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

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

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

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

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

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

Reproduce

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