Cubic critical, wide range

Percentage Accurate: 17.8% → 97.6%
Time: 10.3s
Alternatives: 7
Speedup: 23.2×

Specification

?
\[\left(\left(4.930380657631324 \cdot 10^{-32} < a \land a < 2.028240960365167 \cdot 10^{+31}\right) \land \left(4.930380657631324 \cdot 10^{-32} < b \land b < 2.028240960365167 \cdot 10^{+31}\right)\right) \land \left(4.930380657631324 \cdot 10^{-32} < c \land c < 2.028240960365167 \cdot 10^{+31}\right)\]
\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(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: 17.8% 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: 97.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \frac{-1.0546875 \cdot {\left(c \cdot a\right)}^{4}}{a \cdot {b}^{7}}\right)\right)\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (fma
  -0.5625
  (/ (pow c 3.0) (/ (pow b 5.0) (* a a)))
  (fma
   -0.5
   (/ c b)
   (fma
    -0.375
    (/ a (/ (pow b 3.0) (* c c)))
    (/ (* -1.0546875 (pow (* c a) 4.0)) (* a (pow b 7.0)))))))
double code(double a, double b, double c) {
	return fma(-0.5625, (pow(c, 3.0) / (pow(b, 5.0) / (a * a))), fma(-0.5, (c / b), fma(-0.375, (a / (pow(b, 3.0) / (c * c))), ((-1.0546875 * pow((c * a), 4.0)) / (a * pow(b, 7.0))))));
}
function code(a, b, c)
	return fma(-0.5625, Float64((c ^ 3.0) / Float64((b ^ 5.0) / Float64(a * a))), fma(-0.5, Float64(c / b), fma(-0.375, Float64(a / Float64((b ^ 3.0) / Float64(c * c))), Float64(Float64(-1.0546875 * (Float64(c * a) ^ 4.0)) / Float64(a * (b ^ 7.0))))))
end
code[a_, b_, c_] := N[(-0.5625 * N[(N[Power[c, 3.0], $MachinePrecision] / N[(N[Power[b, 5.0], $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision] + N[(-0.375 * N[(a / N[(N[Power[b, 3.0], $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0546875 * N[Power[N[(c * a), $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] / N[(a * N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \frac{-1.0546875 \cdot {\left(c \cdot a\right)}^{4}}{a \cdot {b}^{7}}\right)\right)\right)
\end{array}
Derivation
  1. Initial program 14.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. neg-sub014.6%

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

      \[\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-14.6%

      \[\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-neg14.6%

      \[\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} \]
    5. neg-mul-114.6%

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

    \[\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. add-exp-log14.6%

      \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{e^{\log \left(\frac{a}{0.3333333333333333}\right)}}} \]
  5. Applied egg-rr14.6%

    \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{e^{\log \left(\frac{a}{0.3333333333333333}\right)}}} \]
  6. Taylor expanded in b around inf 98.8%

    \[\leadsto \color{blue}{-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \frac{5.0625 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-1.125 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right)} \]
  7. Simplified98.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \frac{-0.16666666666666666}{\frac{a \cdot {b}^{7}}{{\left(a \cdot c\right)}^{4} \cdot 6.328125}}\right)\right)\right)} \]
  8. Step-by-step derivation
    1. expm1-log1p-u97.9%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-0.16666666666666666}{\frac{a \cdot {b}^{7}}{{\left(a \cdot c\right)}^{4} \cdot 6.328125}}\right)\right)}\right)\right)\right) \]
    2. expm1-udef97.6%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \color{blue}{e^{\mathsf{log1p}\left(\frac{-0.16666666666666666}{\frac{a \cdot {b}^{7}}{{\left(a \cdot c\right)}^{4} \cdot 6.328125}}\right)} - 1}\right)\right)\right) \]
    3. associate-/r/97.6%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, e^{\mathsf{log1p}\left(\color{blue}{\frac{-0.16666666666666666}{a \cdot {b}^{7}} \cdot \left({\left(a \cdot c\right)}^{4} \cdot 6.328125\right)}\right)} - 1\right)\right)\right) \]
  9. Applied egg-rr97.6%

    \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \color{blue}{e^{\mathsf{log1p}\left(\frac{-0.16666666666666666}{a \cdot {b}^{7}} \cdot \left({\left(a \cdot c\right)}^{4} \cdot 6.328125\right)\right)} - 1}\right)\right)\right) \]
  10. Step-by-step derivation
    1. expm1-def97.9%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-0.16666666666666666}{a \cdot {b}^{7}} \cdot \left({\left(a \cdot c\right)}^{4} \cdot 6.328125\right)\right)\right)}\right)\right)\right) \]
    2. expm1-log1p98.8%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \color{blue}{\frac{-0.16666666666666666}{a \cdot {b}^{7}} \cdot \left({\left(a \cdot c\right)}^{4} \cdot 6.328125\right)}\right)\right)\right) \]
    3. associate-*l/98.8%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \color{blue}{\frac{-0.16666666666666666 \cdot \left({\left(a \cdot c\right)}^{4} \cdot 6.328125\right)}{a \cdot {b}^{7}}}\right)\right)\right) \]
    4. *-commutative98.8%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \frac{-0.16666666666666666 \cdot \color{blue}{\left(6.328125 \cdot {\left(a \cdot c\right)}^{4}\right)}}{a \cdot {b}^{7}}\right)\right)\right) \]
    5. associate-*r*98.8%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \frac{\color{blue}{\left(-0.16666666666666666 \cdot 6.328125\right) \cdot {\left(a \cdot c\right)}^{4}}}{a \cdot {b}^{7}}\right)\right)\right) \]
    6. metadata-eval98.8%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \frac{\color{blue}{-1.0546875} \cdot {\left(a \cdot c\right)}^{4}}{a \cdot {b}^{7}}\right)\right)\right) \]
  11. Simplified98.8%

    \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \color{blue}{\frac{-1.0546875 \cdot {\left(a \cdot c\right)}^{4}}{a \cdot {b}^{7}}}\right)\right)\right) \]
  12. Final simplification98.8%

    \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{c \cdot c}}, \frac{-1.0546875 \cdot {\left(c \cdot a\right)}^{4}}{a \cdot {b}^{7}}\right)\right)\right) \]

Alternative 2: 97.3% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(-0.5625, {c}^{3} \cdot \frac{a \cdot a}{{b}^{5}}, \mathsf{fma}\left(c, \frac{-0.5}{b}, \mathsf{fma}\left(-0.375, \left(c \cdot c\right) \cdot \frac{a}{{b}^{3}}, \frac{-1.0546875 \cdot {\left(c \cdot a\right)}^{4}}{a \cdot {b}^{7}}\right)\right)\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (fma
  -0.5625
  (* (pow c 3.0) (/ (* a a) (pow b 5.0)))
  (fma
   c
   (/ -0.5 b)
   (fma
    -0.375
    (* (* c c) (/ a (pow b 3.0)))
    (/ (* -1.0546875 (pow (* c a) 4.0)) (* a (pow b 7.0)))))))
double code(double a, double b, double c) {
	return fma(-0.5625, (pow(c, 3.0) * ((a * a) / pow(b, 5.0))), fma(c, (-0.5 / b), fma(-0.375, ((c * c) * (a / pow(b, 3.0))), ((-1.0546875 * pow((c * a), 4.0)) / (a * pow(b, 7.0))))));
}
function code(a, b, c)
	return fma(-0.5625, Float64((c ^ 3.0) * Float64(Float64(a * a) / (b ^ 5.0))), fma(c, Float64(-0.5 / b), fma(-0.375, Float64(Float64(c * c) * Float64(a / (b ^ 3.0))), Float64(Float64(-1.0546875 * (Float64(c * a) ^ 4.0)) / Float64(a * (b ^ 7.0))))))
end
code[a_, b_, c_] := N[(-0.5625 * N[(N[Power[c, 3.0], $MachinePrecision] * N[(N[(a * a), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * N[(-0.5 / b), $MachinePrecision] + N[(-0.375 * N[(N[(c * c), $MachinePrecision] * N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0546875 * N[Power[N[(c * a), $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] / N[(a * N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(-0.5625, {c}^{3} \cdot \frac{a \cdot a}{{b}^{5}}, \mathsf{fma}\left(c, \frac{-0.5}{b}, \mathsf{fma}\left(-0.375, \left(c \cdot c\right) \cdot \frac{a}{{b}^{3}}, \frac{-1.0546875 \cdot {\left(c \cdot a\right)}^{4}}{a \cdot {b}^{7}}\right)\right)\right)
\end{array}
Derivation
  1. Initial program 14.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. neg-sub014.6%

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

      \[\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-14.6%

      \[\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-neg14.6%

      \[\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} \]
    5. neg-mul-114.6%

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

    \[\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. add-exp-log14.6%

      \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{e^{\log \left(\frac{a}{0.3333333333333333}\right)}}} \]
  5. Applied egg-rr14.6%

    \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{e^{\log \left(\frac{a}{0.3333333333333333}\right)}}} \]
  6. Step-by-step derivation
    1. add-exp-log14.7%

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

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

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

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

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

    \[\leadsto \color{blue}{-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.16666666666666666 \cdot \frac{5.0625 \cdot \left({a}^{4} \cdot {c}^{4}\right) + {\left(-1.125 \cdot \left({a}^{2} \cdot {c}^{2}\right)\right)}^{2}}{a \cdot {b}^{7}}\right)\right)} \]
  9. Simplified98.5%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(c, \frac{-0.5}{b}, \mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), \frac{-1.0546875 \cdot {\left(a \cdot c\right)}^{4}}{a \cdot {b}^{7}}\right)\right)\right)} \]
  10. Final simplification98.5%

    \[\leadsto \mathsf{fma}\left(-0.5625, {c}^{3} \cdot \frac{a \cdot a}{{b}^{5}}, \mathsf{fma}\left(c, \frac{-0.5}{b}, \mathsf{fma}\left(-0.375, \left(c \cdot c\right) \cdot \frac{a}{{b}^{3}}, \frac{-1.0546875 \cdot {\left(c \cdot a\right)}^{4}}{a \cdot {b}^{7}}\right)\right)\right) \]

Alternative 3: 96.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(-0.5625, {c}^{3} \cdot \frac{a \cdot a}{{b}^{5}}, \mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, \frac{-0.5}{\frac{b}{c}}\right)\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (fma
  -0.5625
  (* (pow c 3.0) (/ (* a a) (pow b 5.0)))
  (fma -0.375 (/ (* c c) (/ (pow b 3.0) a)) (/ -0.5 (/ b c)))))
double code(double a, double b, double c) {
	return fma(-0.5625, (pow(c, 3.0) * ((a * a) / pow(b, 5.0))), fma(-0.375, ((c * c) / (pow(b, 3.0) / a)), (-0.5 / (b / c))));
}
function code(a, b, c)
	return fma(-0.5625, Float64((c ^ 3.0) * Float64(Float64(a * a) / (b ^ 5.0))), fma(-0.375, Float64(Float64(c * c) / Float64((b ^ 3.0) / a)), Float64(-0.5 / Float64(b / c))))
end
code[a_, b_, c_] := N[(-0.5625 * N[(N[Power[c, 3.0], $MachinePrecision] * N[(N[(a * a), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(N[(c * c), $MachinePrecision] / N[(N[Power[b, 3.0], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + N[(-0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(-0.5625, {c}^{3} \cdot \frac{a \cdot a}{{b}^{5}}, \mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, \frac{-0.5}{\frac{b}{c}}\right)\right)
\end{array}
Derivation
  1. Initial program 14.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. neg-sub014.6%

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

      \[\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-14.6%

      \[\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-neg14.6%

      \[\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} \]
    5. neg-mul-114.6%

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

    \[\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. add-exp-log14.6%

      \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{e^{\log \left(\frac{a}{0.3333333333333333}\right)}}} \]
  5. Applied egg-rr14.6%

    \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{e^{\log \left(\frac{a}{0.3333333333333333}\right)}}} \]
  6. Taylor expanded in b around inf 98.3%

    \[\leadsto \color{blue}{-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right)} \]
  7. Step-by-step derivation
    1. fma-def98.3%

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

      \[\leadsto \mathsf{fma}\left(-0.5625, \color{blue}{\frac{{a}^{2}}{\frac{{b}^{5}}{{c}^{3}}}}, -0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
    3. associate-/r/98.3%

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \color{blue}{\frac{c \cdot c}{\frac{{b}^{3}}{a}}}, -0.5 \cdot \frac{c}{b}\right)\right) \]
    10. associate-*r/98.3%

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, \frac{-0.5}{\frac{b}{c}}\right)\right)} \]
  9. Final simplification97.9%

    \[\leadsto \mathsf{fma}\left(-0.5625, {c}^{3} \cdot \frac{a \cdot a}{{b}^{5}}, \mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, \frac{-0.5}{\frac{b}{c}}\right)\right) \]

Alternative 4: 96.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(-0.5625, {c}^{3} \cdot \frac{a \cdot a}{{b}^{5}}, \mathsf{fma}\left(c, \frac{-0.5}{b}, -0.375 \cdot \left(\left(c \cdot c\right) \cdot \frac{a}{{b}^{3}}\right)\right)\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (fma
  -0.5625
  (* (pow c 3.0) (/ (* a a) (pow b 5.0)))
  (fma c (/ -0.5 b) (* -0.375 (* (* c c) (/ a (pow b 3.0)))))))
double code(double a, double b, double c) {
	return fma(-0.5625, (pow(c, 3.0) * ((a * a) / pow(b, 5.0))), fma(c, (-0.5 / b), (-0.375 * ((c * c) * (a / pow(b, 3.0))))));
}
function code(a, b, c)
	return fma(-0.5625, Float64((c ^ 3.0) * Float64(Float64(a * a) / (b ^ 5.0))), fma(c, Float64(-0.5 / b), Float64(-0.375 * Float64(Float64(c * c) * Float64(a / (b ^ 3.0))))))
end
code[a_, b_, c_] := N[(-0.5625 * N[(N[Power[c, 3.0], $MachinePrecision] * N[(N[(a * a), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * N[(-0.5 / b), $MachinePrecision] + N[(-0.375 * N[(N[(c * c), $MachinePrecision] * N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(-0.5625, {c}^{3} \cdot \frac{a \cdot a}{{b}^{5}}, \mathsf{fma}\left(c, \frac{-0.5}{b}, -0.375 \cdot \left(\left(c \cdot c\right) \cdot \frac{a}{{b}^{3}}\right)\right)\right)
\end{array}
Derivation
  1. Initial program 14.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. neg-sub014.6%

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

      \[\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-14.6%

      \[\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-neg14.6%

      \[\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} \]
    5. neg-mul-114.6%

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

    \[\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. add-exp-log14.6%

      \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{e^{\log \left(\frac{a}{0.3333333333333333}\right)}}} \]
  5. Applied egg-rr14.6%

    \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{e^{\log \left(\frac{a}{0.3333333333333333}\right)}}} \]
  6. Step-by-step derivation
    1. add-exp-log14.7%

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

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

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

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

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

    \[\leadsto \color{blue}{-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right)} \]
  9. Step-by-step derivation
    1. fma-def98.3%

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

      \[\leadsto \mathsf{fma}\left(-0.5625, \color{blue}{\frac{{a}^{2}}{\frac{{b}^{5}}{{c}^{3}}}}, -0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
    3. associate-/r/98.3%

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{a \cdot a}{{b}^{5}} \cdot {c}^{3}, \mathsf{fma}\left(c, \frac{-0.5}{b}, -0.375 \cdot \color{blue}{\frac{a}{\frac{{b}^{3}}{{c}^{2}}}}\right)\right) \]
    10. associate-/r/98.0%

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

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

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

    \[\leadsto \mathsf{fma}\left(-0.5625, {c}^{3} \cdot \frac{a \cdot a}{{b}^{5}}, \mathsf{fma}\left(c, \frac{-0.5}{b}, -0.375 \cdot \left(\left(c \cdot c\right) \cdot \frac{a}{{b}^{3}}\right)\right)\right) \]

Alternative 5: 96.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(-0.5625, \frac{{c}^{3} \cdot \left(a \cdot a\right)}{{b}^{5}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right)\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (fma
  -0.5625
  (/ (* (pow c 3.0) (* a a)) (pow b 5.0))
  (fma -0.5 (/ c b) (* -0.375 (/ a (/ (pow b 3.0) (* c c)))))))
double code(double a, double b, double c) {
	return fma(-0.5625, ((pow(c, 3.0) * (a * a)) / pow(b, 5.0)), fma(-0.5, (c / b), (-0.375 * (a / (pow(b, 3.0) / (c * c))))));
}
function code(a, b, c)
	return fma(-0.5625, Float64(Float64((c ^ 3.0) * Float64(a * a)) / (b ^ 5.0)), fma(-0.5, Float64(c / b), Float64(-0.375 * Float64(a / Float64((b ^ 3.0) / Float64(c * c))))))
end
code[a_, b_, c_] := N[(-0.5625 * N[(N[(N[Power[c, 3.0], $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision] + N[(-0.375 * N[(a / N[(N[Power[b, 3.0], $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(-0.5625, \frac{{c}^{3} \cdot \left(a \cdot a\right)}{{b}^{5}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right)\right)
\end{array}
Derivation
  1. Initial program 14.6%

    \[\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 98.3%

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3} \cdot \left(a \cdot a\right)}{{b}^{5}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{a}{\frac{{b}^{3}}{c \cdot c}}\right)\right) \]

Alternative 6: 95.3% accurate, 1.0× speedup?

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

\\
-0.5 \cdot \frac{c}{b} + \frac{a \cdot -0.375}{\frac{{b}^{3}}{c \cdot c}}
\end{array}
Derivation
  1. Initial program 14.6%

    \[\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 97.0%

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \frac{c}{b} + \color{blue}{\frac{-0.375 \cdot a}{\frac{{b}^{3}}{c \cdot c}}} \]
    3. *-commutative97.0%

      \[\leadsto -0.5 \cdot \frac{c}{b} + \frac{\color{blue}{a \cdot -0.375}}{\frac{{b}^{3}}{c \cdot c}} \]
  6. Applied egg-rr97.0%

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b} + \frac{a \cdot -0.375}{\frac{{b}^{3}}{c \cdot c}}} \]
  7. Final simplification97.0%

    \[\leadsto -0.5 \cdot \frac{c}{b} + \frac{a \cdot -0.375}{\frac{{b}^{3}}{c \cdot c}} \]

Alternative 7: 90.4% 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 14.6%

    \[\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 92.8%

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

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

Reproduce

?
herbie shell --seed 2023291 
(FPCore (a b c)
  :name "Cubic critical, wide range"
  :precision binary64
  :pre (and (and (and (< 4.930380657631324e-32 a) (< a 2.028240960365167e+31)) (and (< 4.930380657631324e-32 b) (< b 2.028240960365167e+31))) (and (< 4.930380657631324e-32 c) (< c 2.028240960365167e+31)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))