Cubic critical, wide range

Percentage Accurate: 18.2% → 97.6%
Time: 10.6s
Alternatives: 8
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 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: 18.2% 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} \\ -0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -1.0546875 \cdot \frac{{c}^{4} \cdot {a}^{3}}{{b}^{7}}\right)\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (+
  (* -0.5625 (/ (* (pow c 3.0) (pow a 2.0)) (pow b 5.0)))
  (+
   (* -0.5 (/ c b))
   (+
    (* -0.375 (/ (* a (pow c 2.0)) (pow b 3.0)))
    (* -1.0546875 (/ (* (pow c 4.0) (pow a 3.0)) (pow b 7.0)))))))
double code(double a, double b, double c) {
	return (-0.5625 * ((pow(c, 3.0) * pow(a, 2.0)) / pow(b, 5.0))) + ((-0.5 * (c / b)) + ((-0.375 * ((a * pow(c, 2.0)) / pow(b, 3.0))) + (-1.0546875 * ((pow(c, 4.0) * pow(a, 3.0)) / pow(b, 7.0)))));
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = ((-0.5625d0) * (((c ** 3.0d0) * (a ** 2.0d0)) / (b ** 5.0d0))) + (((-0.5d0) * (c / b)) + (((-0.375d0) * ((a * (c ** 2.0d0)) / (b ** 3.0d0))) + ((-1.0546875d0) * (((c ** 4.0d0) * (a ** 3.0d0)) / (b ** 7.0d0)))))
end function
public static double code(double a, double b, double c) {
	return (-0.5625 * ((Math.pow(c, 3.0) * Math.pow(a, 2.0)) / Math.pow(b, 5.0))) + ((-0.5 * (c / b)) + ((-0.375 * ((a * Math.pow(c, 2.0)) / Math.pow(b, 3.0))) + (-1.0546875 * ((Math.pow(c, 4.0) * Math.pow(a, 3.0)) / Math.pow(b, 7.0)))));
}
def code(a, b, c):
	return (-0.5625 * ((math.pow(c, 3.0) * math.pow(a, 2.0)) / math.pow(b, 5.0))) + ((-0.5 * (c / b)) + ((-0.375 * ((a * math.pow(c, 2.0)) / math.pow(b, 3.0))) + (-1.0546875 * ((math.pow(c, 4.0) * math.pow(a, 3.0)) / math.pow(b, 7.0)))))
function code(a, b, c)
	return Float64(Float64(-0.5625 * Float64(Float64((c ^ 3.0) * (a ^ 2.0)) / (b ^ 5.0))) + Float64(Float64(-0.5 * Float64(c / b)) + Float64(Float64(-0.375 * Float64(Float64(a * (c ^ 2.0)) / (b ^ 3.0))) + Float64(-1.0546875 * Float64(Float64((c ^ 4.0) * (a ^ 3.0)) / (b ^ 7.0))))))
end
function tmp = code(a, b, c)
	tmp = (-0.5625 * (((c ^ 3.0) * (a ^ 2.0)) / (b ^ 5.0))) + ((-0.5 * (c / b)) + ((-0.375 * ((a * (c ^ 2.0)) / (b ^ 3.0))) + (-1.0546875 * (((c ^ 4.0) * (a ^ 3.0)) / (b ^ 7.0)))));
end
code[a_, b_, c_] := N[(N[(-0.5625 * N[(N[(N[Power[c, 3.0], $MachinePrecision] * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.375 * N[(N[(a * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0546875 * N[(N[(N[Power[c, 4.0], $MachinePrecision] * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
-0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -1.0546875 \cdot \frac{{c}^{4} \cdot {a}^{3}}{{b}^{7}}\right)\right)
\end{array}
Derivation
  1. Initial program 20.5%

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

    \[\leadsto \frac{\color{blue}{-1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}} + \left(-1.5 \cdot \frac{c \cdot a}{b} + \left(-0.5 \cdot \frac{{a}^{4} \cdot \left(5.0625 \cdot \frac{{c}^{4}}{{b}^{6}} + {\left(-1.125 \cdot \frac{{c}^{2}}{{b}^{3}}\right)}^{2}\right)}{b} + -1.6875 \cdot \frac{{c}^{3} \cdot {a}^{3}}{{b}^{5}}\right)\right)}}{3 \cdot a} \]
  3. Simplified96.1%

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1.125, \frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, \mathsf{fma}\left(-1.5, \frac{c}{\frac{b}{a}}, \mathsf{fma}\left(-0.5, \frac{{a}^{4}}{\frac{b}{\mathsf{fma}\left(5.0625, \frac{{c}^{4}}{{b}^{6}}, \frac{{c}^{4}}{{b}^{6}} \cdot 1.265625\right)}}, -1.6875 \cdot \frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}\right)\right)\right)}}{3 \cdot a} \]
  4. Taylor expanded in c around 0 96.7%

    \[\leadsto \color{blue}{-0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -1.0546875 \cdot \frac{{c}^{4} \cdot {a}^{3}}{{b}^{7}}\right)\right)} \]
  5. Final simplification96.7%

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

Alternative 2: 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.16666666666666666, \frac{{\left(c \cdot a\right)}^{4}}{\frac{a \cdot {b}^{7}}{6.328125}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}}\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.16666666666666666
   (/ (pow (* c a) 4.0) (/ (* a (pow b 7.0)) 6.328125))
   (fma -0.5 (/ c b) (* -0.375 (/ (* c c) (/ (pow b 3.0) a)))))))
double code(double a, double b, double c) {
	return fma(-0.5625, (pow(c, 3.0) / (pow(b, 5.0) / (a * a))), fma(-0.16666666666666666, (pow((c * a), 4.0) / ((a * pow(b, 7.0)) / 6.328125)), fma(-0.5, (c / b), (-0.375 * ((c * c) / (pow(b, 3.0) / a))))));
}
function code(a, b, c)
	return fma(-0.5625, Float64((c ^ 3.0) / Float64((b ^ 5.0) / Float64(a * a))), fma(-0.16666666666666666, Float64((Float64(c * a) ^ 4.0) / Float64(Float64(a * (b ^ 7.0)) / 6.328125)), fma(-0.5, Float64(c / b), Float64(-0.375 * Float64(Float64(c * c) / Float64((b ^ 3.0) / a))))))
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.16666666666666666 * N[(N[Power[N[(c * a), $MachinePrecision], 4.0], $MachinePrecision] / N[(N[(a * N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision] / 6.328125), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision] + N[(-0.375 * N[(N[(c * c), $MachinePrecision] / N[(N[Power[b, 3.0], $MachinePrecision] / a), $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.16666666666666666, \frac{{\left(c \cdot a\right)}^{4}}{\frac{a \cdot {b}^{7}}{6.328125}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}}\right)\right)\right)
\end{array}
Derivation
  1. Initial program 20.5%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.16666666666666666, \frac{{\left(-1.125 \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot a\right)\right)\right)}^{2} + 5.0625 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}}\right)\right)\right)} \]
  5. Taylor expanded in c around 0 96.7%

    \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.16666666666666666, \color{blue}{\frac{{c}^{4} \cdot \left(1.265625 \cdot {a}^{4} + 5.0625 \cdot {a}^{4}\right)}{a \cdot {b}^{7}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}}\right)\right)\right) \]
  6. Step-by-step derivation
    1. distribute-rgt-out96.7%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.16666666666666666, \frac{\left(\left({c}^{2} \cdot {c}^{2}\right) \cdot \color{blue}{\left({a}^{2} \cdot {a}^{2}\right)}\right) \cdot \left(1.265625 + 5.0625\right)}{a \cdot {b}^{7}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}}\right)\right)\right) \]
    9. swap-sqr96.7%

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

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

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.16666666666666666, \frac{\left(\left(\left(c \cdot c\right) \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left({c}^{2} \cdot {a}^{2}\right)\right) \cdot \left(1.265625 + 5.0625\right)}{a \cdot {b}^{7}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}}\right)\right)\right) \]
    12. swap-sqr96.7%

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

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

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.16666666666666666, \frac{\left(\left(\left(c \cdot a\right) \cdot \left(c \cdot a\right)\right) \cdot \left(\left(c \cdot c\right) \cdot \color{blue}{\left(a \cdot a\right)}\right)\right) \cdot \left(1.265625 + 5.0625\right)}{a \cdot {b}^{7}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}}\right)\right)\right) \]
    15. swap-sqr96.7%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.16666666666666666, \frac{\left(\left(\left(c \cdot a\right) \cdot \left(c \cdot a\right)\right) \cdot \color{blue}{\left(\left(c \cdot a\right) \cdot \left(c \cdot a\right)\right)}\right) \cdot \left(1.265625 + 5.0625\right)}{a \cdot {b}^{7}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}}\right)\right)\right) \]
    16. unpow296.7%

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

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

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

Alternative 3: 96.5% accurate, 0.2× speedup?

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

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

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

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

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

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

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

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

    \[\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-log-exp7.0%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}{\log \left(e^{\frac{a}{0.3333333333333333}}\right)} - \frac{b}{\log \left(e^{\frac{a}{0.3333333333333333}}\right)}} \]
    2. add-log-exp6.0%

      \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}{\color{blue}{\frac{a}{0.3333333333333333}}} - \frac{b}{\log \left(e^{\frac{a}{0.3333333333333333}}\right)} \]
    3. div-inv6.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 96.8% accurate, 0.2× 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}, \frac{-0.375 \cdot \left(c \cdot c\right)}{\frac{{b}^{3}}{a}}\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) (/ (* -0.375 (* c c)) (/ (pow b 3.0) a)))))
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), ((-0.375 * (c * c)) / (pow(b, 3.0) / a))));
}
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), Float64(Float64(-0.375 * Float64(c * c)) / Float64((b ^ 3.0) / a))))
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[(N[(-0.375 * N[(c * c), $MachinePrecision]), $MachinePrecision] / N[(N[Power[b, 3.0], $MachinePrecision] / a), $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}, \frac{-0.375 \cdot \left(c \cdot c\right)}{\frac{{b}^{3}}{a}}\right)\right)
\end{array}
Derivation
  1. Initial program 20.5%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3}}{\frac{{b}^{5}}{a \cdot a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \frac{-0.375 \cdot \color{blue}{\left(c \cdot c\right)}}{\frac{{b}^{3}}{a}}\right)\right) \]
  4. Simplified95.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}, \frac{-0.375 \cdot \left(c \cdot c\right)}{\frac{{b}^{3}}{a}}\right)\right)} \]
  5. Final simplification95.8%

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

Alternative 5: 90.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a} \leq -5 \cdot 10^{-6}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* 3.0 a)))) b) (* 3.0 a)) -5e-6)
   (* 0.3333333333333333 (/ (- (sqrt (fma b b (* c (* a -3.0)))) b) a))
   (* -0.5 (/ c b))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (3.0 * a)))) - b) / (3.0 * a)) <= -5e-6) {
		tmp = 0.3333333333333333 * ((sqrt(fma(b, b, (c * (a * -3.0)))) - b) / a);
	} else {
		tmp = -0.5 * (c / b);
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(3.0 * a)))) - b) / Float64(3.0 * a)) <= -5e-6)
		tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -3.0)))) - b) / a));
	else
		tmp = Float64(-0.5 * Float64(c / b));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[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], -5e-6], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a} \leq -5 \cdot 10^{-6}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)} - b}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)) < -5.00000000000000041e-6

    1. Initial program 68.3%

      \[\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-sub068.3%

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

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

        \[\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-neg68.3%

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

        \[\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. Simplified68.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. add-log-exp25.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000000041e-6 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a))

    1. Initial program 12.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 94.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a} \leq -5 \cdot 10^{-6}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]

Alternative 6: 90.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a}\\ \mathbf{if}\;t_0 \leq -5 \cdot 10^{-6}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (- (sqrt (- (* b b) (* c (* 3.0 a)))) b) (* 3.0 a))))
   (if (<= t_0 -5e-6) t_0 (* -0.5 (/ c b)))))
double code(double a, double b, double c) {
	double t_0 = (sqrt(((b * b) - (c * (3.0 * a)))) - b) / (3.0 * a);
	double tmp;
	if (t_0 <= -5e-6) {
		tmp = t_0;
	} else {
		tmp = -0.5 * (c / 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) :: t_0
    real(8) :: tmp
    t_0 = (sqrt(((b * b) - (c * (3.0d0 * a)))) - b) / (3.0d0 * a)
    if (t_0 <= (-5d-6)) then
        tmp = t_0
    else
        tmp = (-0.5d0) * (c / b)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = (Math.sqrt(((b * b) - (c * (3.0 * a)))) - b) / (3.0 * a);
	double tmp;
	if (t_0 <= -5e-6) {
		tmp = t_0;
	} else {
		tmp = -0.5 * (c / b);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = (math.sqrt(((b * b) - (c * (3.0 * a)))) - b) / (3.0 * a)
	tmp = 0
	if t_0 <= -5e-6:
		tmp = t_0
	else:
		tmp = -0.5 * (c / b)
	return tmp
function code(a, b, c)
	t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(3.0 * a)))) - b) / Float64(3.0 * a))
	tmp = 0.0
	if (t_0 <= -5e-6)
		tmp = t_0;
	else
		tmp = Float64(-0.5 * Float64(c / b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = (sqrt(((b * b) - (c * (3.0 * a)))) - b) / (3.0 * a);
	tmp = 0.0;
	if (t_0 <= -5e-6)
		tmp = t_0;
	else
		tmp = -0.5 * (c / b);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, -5e-6], t$95$0, N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a}\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{-6}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a)) < -5.00000000000000041e-6

    1. Initial program 68.3%

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

    if -5.00000000000000041e-6 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a))

    1. Initial program 12.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 94.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a} \leq -5 \cdot 10^{-6}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]

Alternative 7: 95.2% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 8: 90.1% 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 20.5%

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

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

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

Reproduce

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