Cubic critical, medium range

Percentage Accurate: 31.6% → 99.8%
Time: 11.8s
Alternatives: 5
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 5 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.6% 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.5× speedup?

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

\\
\frac{c}{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, \left(c \cdot a\right) \cdot -3\right)}}
\end{array}
Derivation
  1. Initial program 29.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-sub029.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
  4. Step-by-step derivation
    1. add-log-exp10.9%

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \log \left({\left(e^{\color{blue}{a \cdot 3}}\right)}^{c}\right)}}{3 \cdot a} \]
    5. exp-prod8.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}}{3 \cdot a} \]
  10. Step-by-step derivation
    1. *-un-lft-identity30.5%

      \[\leadsto \color{blue}{1 \cdot \frac{\frac{\left(-b\right) \cdot \left(-b\right) - \left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}{3 \cdot a}} \]
    2. associate-/l/30.5%

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

      \[\leadsto 1 \cdot \frac{\color{blue}{b \cdot b} - \left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right)} \]
    4. associate--r-99.3%

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

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

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

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

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

    \[\leadsto 1 \cdot \color{blue}{\left(\left(0 + c \cdot \left(a \cdot 3\right)\right) \cdot \frac{1}{\left(a \cdot 3\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right)}\right)} \]
  14. Step-by-step derivation
    1. +-lft-identity99.2%

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

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

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

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

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

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

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

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

      \[\leadsto 1 \cdot \frac{\frac{c}{1} \cdot \color{blue}{1}}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}} \]
    10. fma-neg99.8%

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

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

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

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

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

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

Alternative 2: 99.3% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := c \cdot \left(a \cdot 3\right)\\
t_0 \cdot \frac{\frac{1}{a \cdot 3}}{\left(-b\right) - \sqrt{b \cdot b - t_0}}
\end{array}
\end{array}
Derivation
  1. Initial program 29.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-sub029.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
  4. Step-by-step derivation
    1. add-log-exp10.9%

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \log \left({\left(e^{\color{blue}{a \cdot 3}}\right)}^{c}\right)}}{3 \cdot a} \]
    5. exp-prod8.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}}{3 \cdot a} \]
  10. Step-by-step derivation
    1. *-un-lft-identity30.5%

      \[\leadsto \color{blue}{1 \cdot \frac{\frac{\left(-b\right) \cdot \left(-b\right) - \left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}{3 \cdot a}} \]
    2. associate-/l/30.5%

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

      \[\leadsto 1 \cdot \frac{\color{blue}{b \cdot b} - \left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right)} \]
    4. associate--r-99.3%

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

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

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

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

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

    \[\leadsto 1 \cdot \color{blue}{\left(\left(0 + c \cdot \left(a \cdot 3\right)\right) \cdot \frac{1}{\left(a \cdot 3\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right)}\right)} \]
  14. Step-by-step derivation
    1. +-lft-identity99.2%

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

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

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

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

Alternative 3: 99.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := c \cdot \left(a \cdot 3\right)\\
\frac{t_0}{\left(a \cdot 3\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - t_0}\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 29.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-sub029.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
  4. Step-by-step derivation
    1. add-log-exp10.9%

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \log \left({\left(e^{\color{blue}{a \cdot 3}}\right)}^{c}\right)}}{3 \cdot a} \]
    5. exp-prod8.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}}{3 \cdot a} \]
  10. Step-by-step derivation
    1. *-un-lft-identity30.5%

      \[\leadsto \color{blue}{1 \cdot \frac{\frac{\left(-b\right) \cdot \left(-b\right) - \left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}{3 \cdot a}} \]
    2. associate-/l/30.5%

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

      \[\leadsto 1 \cdot \frac{\color{blue}{b \cdot b} - \left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right)} \]
    4. associate--r-99.3%

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

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

    \[\leadsto \color{blue}{1 \cdot \frac{\left(b \cdot b - b \cdot b\right) + c \cdot \left(a \cdot 3\right)}{\left(a \cdot 3\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right)}} \]
  12. Step-by-step derivation
    1. *-un-lft-identity99.3%

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

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

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

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

Alternative 4: 90.7% accurate, 4.0× speedup?

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

\\
\frac{c \cdot \left(a \cdot 3\right) + \left(b \cdot b - b \cdot b\right)}{\left(a \cdot 3\right) \cdot \left(1.5 \cdot \frac{c \cdot a}{b} + b \cdot -2\right)}
\end{array}
Derivation
  1. Initial program 29.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-sub029.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
  4. Step-by-step derivation
    1. add-log-exp10.9%

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \log \left({\left(e^{\color{blue}{a \cdot 3}}\right)}^{c}\right)}}{3 \cdot a} \]
    5. exp-prod8.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}}{3 \cdot a} \]
  10. Step-by-step derivation
    1. *-un-lft-identity30.5%

      \[\leadsto \color{blue}{1 \cdot \frac{\frac{\left(-b\right) \cdot \left(-b\right) - \left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}{3 \cdot a}} \]
    2. associate-/l/30.5%

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

      \[\leadsto 1 \cdot \frac{\color{blue}{b \cdot b} - \left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right)} \]
    4. associate--r-99.3%

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

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

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

    \[\leadsto 1 \cdot \frac{\left(b \cdot b - b \cdot b\right) + c \cdot \left(a \cdot 3\right)}{\left(a \cdot 3\right) \cdot \color{blue}{\left(1.5 \cdot \frac{c \cdot a}{b} + -2 \cdot b\right)}} \]
  13. Final simplification91.3%

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

Alternative 5: 81.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 29.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. /-rgt-identity29.6%

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\frac{3 \cdot a}{\color{blue}{--1}}} \]
    3. associate-/r/29.6%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{-1} \cdot \frac{-1}{3 \cdot a}} \]
    9. associate-/r*29.6%

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

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

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

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

Reproduce

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