Cubic critical, medium range

Percentage Accurate: 31.1% → 99.8%
Time: 15.6s
Alternatives: 6
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 6 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.1% 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.8% accurate, 0.4× speedup?

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. add-exp-log31.6%

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

    \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{e^{\log \left(3 \cdot \left(a \cdot c\right)\right)}}}}{3 \cdot a} \]
  7. Step-by-step derivation
    1. flip-+31.7%

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left(\color{blue}{{b}^{2}} - e^{\log \left(3 \cdot \left(a \cdot c\right)\right)}\right)}{\left(-b\right) - \sqrt{b \cdot b - e^{\log \left(3 \cdot \left(a \cdot c\right)\right)}}}}{3 \cdot a} \]
    5. rem-exp-log32.7%

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \left(a \cdot 3\right) \cdot c\right)}{\left(-b\right) - \sqrt{\color{blue}{{b}^{2}} - e^{\log \left(3 \cdot \left(a \cdot c\right)\right)}}}}{3 \cdot a} \]
    9. rem-exp-log32.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{c \cdot \left(a \cdot 3\right)}{a \cdot 3}}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{3 \cdot \left(a \cdot c\right)}}} \]
    13. cancel-sign-sub-inv99.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\log \left(e^{c \cdot 1}\right)} \cdot \frac{1}{\left(-b\right) - \sqrt{\mathsf{fma}\left(-3, c \cdot a, {b}^{2}\right)}} \]
    9. exp-prod44.8%

      \[\leadsto \log \color{blue}{\left({\left(e^{c}\right)}^{1}\right)} \cdot \frac{1}{\left(-b\right) - \sqrt{\mathsf{fma}\left(-3, c \cdot a, {b}^{2}\right)}} \]
    10. pow144.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, 0.5× speedup?

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. add-exp-log31.6%

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

    \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{e^{\log \left(3 \cdot \left(a \cdot c\right)\right)}}}}{3 \cdot a} \]
  7. Step-by-step derivation
    1. flip-+31.7%

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left(\color{blue}{{b}^{2}} - e^{\log \left(3 \cdot \left(a \cdot c\right)\right)}\right)}{\left(-b\right) - \sqrt{b \cdot b - e^{\log \left(3 \cdot \left(a \cdot c\right)\right)}}}}{3 \cdot a} \]
    5. rem-exp-log32.7%

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

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

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

      \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \left(a \cdot 3\right) \cdot c\right)}{\left(-b\right) - \sqrt{\color{blue}{{b}^{2}} - e^{\log \left(3 \cdot \left(a \cdot c\right)\right)}}}}{3 \cdot a} \]
    9. rem-exp-log32.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{c \cdot \left(a \cdot 3\right)}{a \cdot 3}}{\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{3 \cdot \left(a \cdot c\right)}}} \]
    13. cancel-sign-sub-inv99.6%

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

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

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

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

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

Alternative 3: 90.9% accurate, 0.5× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
  6. Final simplification90.9%

    \[\leadsto -0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} \]
  7. Add Preprocessing

Alternative 4: 90.6% accurate, 1.0× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - 0.5 \cdot \frac{1}{b}\right)} \]
  6. Step-by-step derivation
    1. add-cbrt-cube90.1%

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

      \[\leadsto c \cdot \sqrt[3]{\color{blue}{{\left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - 0.5 \cdot \frac{1}{b}\right)}^{3}}} \]
    3. associate-*r/90.2%

      \[\leadsto c \cdot \sqrt[3]{{\left(\color{blue}{\frac{-0.375 \cdot \left(a \cdot c\right)}{{b}^{3}}} - 0.5 \cdot \frac{1}{b}\right)}^{3}} \]
    4. un-div-inv90.2%

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

    \[\leadsto c \cdot \color{blue}{\sqrt[3]{{\left(\frac{-0.375 \cdot \left(a \cdot c\right)}{{b}^{3}} - \frac{0.5}{b}\right)}^{3}}} \]
  8. Step-by-step derivation
    1. rem-cbrt-cube90.6%

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

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

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

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

Alternative 5: 81.2% accurate, 23.2× speedup?

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - 0.5 \cdot \frac{1}{b}\right)} \]
  6. Taylor expanded in a around 0 80.8%

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

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

Alternative 6: 81.5% accurate, 23.2× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    2. *-commutative81.0%

      \[\leadsto \frac{\color{blue}{c \cdot -0.5}}{b} \]
  7. Simplified81.0%

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

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

Reproduce

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