Cubic critical, medium range

Percentage Accurate: 31.5% → 95.9%
Time: 14.2s
Alternatives: 7
Speedup: 23.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 7 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 31.5% 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: 95.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(a \cdot -3\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.002:\\ \;\;\;\;\frac{t_0}{b + \sqrt{\mathsf{fma}\left(b, b, t_0\right)}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\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 \frac{c \cdot c}{\frac{{b}^{3}}{a}}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* c (* a -3.0))))
   (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.002)
     (*
      (/ t_0 (+ b (sqrt (fma b b t_0))))
      (+ (exp (log1p (/ 0.3333333333333333 a))) -1.0))
     (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) {
	double t_0 = c * (a * -3.0);
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.002) {
		tmp = (t_0 / (b + sqrt(fma(b, b, t_0)))) * (exp(log1p((0.3333333333333333 / a))) + -1.0);
	} else {
		tmp = 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)))));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(c * Float64(a * -3.0))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.002)
		tmp = Float64(Float64(t_0 / Float64(b + sqrt(fma(b, b, t_0)))) * Float64(exp(log1p(Float64(0.3333333333333333 / a))) + -1.0));
	else
		tmp = fma(-0.5625, Float64((c ^ 3.0) / Float64((b ^ 5.0) / Float64(a * a))), fma(-0.5, Float64(c / b), Float64(-0.375 * Float64(Float64(c * c) / Float64((b ^ 3.0) / a)))));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], -0.002], N[(N[(t$95$0 / N[(b + N[Sqrt[N[(b * b + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[Log[1 + N[(0.3333333333333333 / a), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(-0.5625 * N[(N[Power[c, 3.0], $MachinePrecision] / N[(N[Power[b, 5.0], $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision] + N[(-0.375 * N[(N[(c * c), $MachinePrecision] / N[(N[Power[b, 3.0], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := c \cdot \left(a \cdot -3\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.002:\\
\;\;\;\;\frac{t_0}{b + \sqrt{\mathsf{fma}\left(b, b, t_0\right)}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} + -1\right)\\

\mathbf{else}:\\
\;\;\;\;\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 \frac{c \cdot c}{\frac{{b}^{3}}{a}}\right)\right)\\


\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)) < -2e-3

    1. Initial program 68.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-sub068.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-68.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-neg68.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-168.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/68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right) - b \cdot b}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} + b}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} - 1\right) \]
    8. Step-by-step derivation
      1. associate-*r*64.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 22.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-sub022.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-22.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-neg22.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-122.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/22.6%

        \[\leadsto \color{blue}{-1 \cdot \frac{b - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}} \]
      6. metadata-eval22.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-eval22.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-frac22.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. *-commutative22.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-frac22.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/22.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. Simplified22.8%

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

      \[\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)} \]
    5. Step-by-step derivation
      1. fma-def98.0%

        \[\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*98.0%

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

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

        \[\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*98.0%

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

        \[\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 \frac{\color{blue}{c \cdot c}}{\frac{{b}^{3}}{a}}\right)\right) \]
    6. Simplified98.0%

      \[\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}, -0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}}\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.002:\\ \;\;\;\;\frac{c \cdot \left(a \cdot -3\right)}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\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 \frac{c \cdot c}{\frac{{b}^{3}}{a}}\right)\right)\\ \end{array} \]

Alternative 2: 95.5% accurate, 0.2× speedup?

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

\\
\mathsf{fma}\left(-1.6875, \frac{\left(a \cdot a\right) \cdot \left({c}^{3} \cdot 0.3333333333333333\right)}{{b}^{5}}, -0.5 \cdot \frac{c}{b}\right) + \mathsf{fma}\left(-1.125, \frac{c \cdot c}{{b}^{3}} \cdot \left(a \cdot 0.3333333333333333\right), -0.16666666666666666 \cdot \left(\frac{{\left(a \cdot c\right)}^{4}}{a} \cdot \frac{6.328125}{{b}^{7}}\right)\right)
\end{array}
Derivation
  1. Initial program 31.1%

    \[\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-sub031.1%

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

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

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

      \[\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/31.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(-1.6875, \frac{\left(a \cdot a\right) \cdot \left({c}^{3} \cdot 0.3333333333333333\right)}{{b}^{5}}, -0.5 \cdot \frac{c}{b}\right) + \mathsf{fma}\left(-1.125, \frac{c \cdot c}{{b}^{3}} \cdot \left(a \cdot 0.3333333333333333\right), \color{blue}{-0.16666666666666666 \cdot \frac{{c}^{4} \cdot \left(1.265625 \cdot {a}^{4} + 5.0625 \cdot {a}^{4}\right)}{a \cdot {b}^{7}}}\right) \]
  9. Step-by-step derivation
    1. +-commutative95.7%

      \[\leadsto \mathsf{fma}\left(-1.6875, \frac{\left(a \cdot a\right) \cdot \left({c}^{3} \cdot 0.3333333333333333\right)}{{b}^{5}}, -0.5 \cdot \frac{c}{b}\right) + \mathsf{fma}\left(-1.125, \frac{c \cdot c}{{b}^{3}} \cdot \left(a \cdot 0.3333333333333333\right), -0.16666666666666666 \cdot \frac{{c}^{4} \cdot \color{blue}{\left(5.0625 \cdot {a}^{4} + 1.265625 \cdot {a}^{4}\right)}}{a \cdot {b}^{7}}\right) \]
    2. distribute-rgt-out95.7%

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

      \[\leadsto \mathsf{fma}\left(-1.6875, \frac{\left(a \cdot a\right) \cdot \left({c}^{3} \cdot 0.3333333333333333\right)}{{b}^{5}}, -0.5 \cdot \frac{c}{b}\right) + \mathsf{fma}\left(-1.125, \frac{c \cdot c}{{b}^{3}} \cdot \left(a \cdot 0.3333333333333333\right), -0.16666666666666666 \cdot \frac{\color{blue}{\left({c}^{4} \cdot {a}^{4}\right) \cdot \left(5.0625 + 1.265625\right)}}{a \cdot {b}^{7}}\right) \]
    4. times-frac95.7%

      \[\leadsto \mathsf{fma}\left(-1.6875, \frac{\left(a \cdot a\right) \cdot \left({c}^{3} \cdot 0.3333333333333333\right)}{{b}^{5}}, -0.5 \cdot \frac{c}{b}\right) + \mathsf{fma}\left(-1.125, \frac{c \cdot c}{{b}^{3}} \cdot \left(a \cdot 0.3333333333333333\right), -0.16666666666666666 \cdot \color{blue}{\left(\frac{{c}^{4} \cdot {a}^{4}}{a} \cdot \frac{5.0625 + 1.265625}{{b}^{7}}\right)}\right) \]
  10. Simplified95.7%

    \[\leadsto \mathsf{fma}\left(-1.6875, \frac{\left(a \cdot a\right) \cdot \left({c}^{3} \cdot 0.3333333333333333\right)}{{b}^{5}}, -0.5 \cdot \frac{c}{b}\right) + \mathsf{fma}\left(-1.125, \frac{c \cdot c}{{b}^{3}} \cdot \left(a \cdot 0.3333333333333333\right), \color{blue}{-0.16666666666666666 \cdot \left(\frac{{\left(c \cdot a\right)}^{4}}{a} \cdot \frac{6.328125}{{b}^{7}}\right)}\right) \]
  11. Final simplification95.7%

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

Alternative 3: 95.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(a \cdot -3\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.002:\\ \;\;\;\;\frac{t_0}{b + \sqrt{\mathsf{fma}\left(b, b, t_0\right)}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{\left(a \cdot c\right) \cdot \left(c \cdot \left(\left(a \cdot a\right) \cdot c\right)\right)}{{b}^{5}}, 1.6875, \mathsf{fma}\left(1.5, a \cdot \frac{c}{b}, 1.125 \cdot \left(\left(a \cdot a\right) \cdot \frac{c}{\frac{{b}^{3}}{c}}\right)\right)\right)}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* c (* a -3.0))))
   (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.002)
     (*
      (/ t_0 (+ b (sqrt (fma b b t_0))))
      (+ (exp (log1p (/ 0.3333333333333333 a))) -1.0))
     (/
      -0.3333333333333333
      (/
       a
       (fma
        (/ (* (* a c) (* c (* (* a a) c))) (pow b 5.0))
        1.6875
        (fma
         1.5
         (* a (/ c b))
         (* 1.125 (* (* a a) (/ c (/ (pow b 3.0) c)))))))))))
double code(double a, double b, double c) {
	double t_0 = c * (a * -3.0);
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.002) {
		tmp = (t_0 / (b + sqrt(fma(b, b, t_0)))) * (exp(log1p((0.3333333333333333 / a))) + -1.0);
	} else {
		tmp = -0.3333333333333333 / (a / fma((((a * c) * (c * ((a * a) * c))) / pow(b, 5.0)), 1.6875, fma(1.5, (a * (c / b)), (1.125 * ((a * a) * (c / (pow(b, 3.0) / c)))))));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(c * Float64(a * -3.0))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.002)
		tmp = Float64(Float64(t_0 / Float64(b + sqrt(fma(b, b, t_0)))) * Float64(exp(log1p(Float64(0.3333333333333333 / a))) + -1.0));
	else
		tmp = Float64(-0.3333333333333333 / Float64(a / fma(Float64(Float64(Float64(a * c) * Float64(c * Float64(Float64(a * a) * c))) / (b ^ 5.0)), 1.6875, fma(1.5, Float64(a * Float64(c / b)), Float64(1.125 * Float64(Float64(a * a) * Float64(c / Float64((b ^ 3.0) / c))))))));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], -0.002], N[(N[(t$95$0 / N[(b + N[Sqrt[N[(b * b + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[Log[1 + N[(0.3333333333333333 / a), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 / N[(a / N[(N[(N[(N[(a * c), $MachinePrecision] * N[(c * N[(N[(a * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] * 1.6875 + N[(1.5 * N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(1.125 * N[(N[(a * a), $MachinePrecision] * N[(c / N[(N[Power[b, 3.0], $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := c \cdot \left(a \cdot -3\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.002:\\
\;\;\;\;\frac{t_0}{b + \sqrt{\mathsf{fma}\left(b, b, t_0\right)}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} + -1\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{\left(a \cdot c\right) \cdot \left(c \cdot \left(\left(a \cdot a\right) \cdot c\right)\right)}{{b}^{5}}, 1.6875, \mathsf{fma}\left(1.5, a \cdot \frac{c}{b}, 1.125 \cdot \left(\left(a \cdot a\right) \cdot \frac{c}{\frac{{b}^{3}}{c}}\right)\right)\right)}}\\


\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)) < -2e-3

    1. Initial program 68.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-sub068.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-68.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-neg68.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-168.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/68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right) - b \cdot b}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} + b}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} - 1\right) \]
    8. Step-by-step derivation
      1. associate-*r*64.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 22.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-identity22.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-eval22.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-/l*22.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -0.3333333333333333 \cdot \frac{\color{blue}{1.6875 \cdot \frac{{c}^{3} \cdot {a}^{3}}{{b}^{5}} + \left(1.5 \cdot \frac{c \cdot a}{b} + 1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}}\right)}}{a} \]
    5. Step-by-step derivation
      1. *-commutative97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\color{blue}{\frac{{c}^{3} \cdot {a}^{3}}{{b}^{5}} \cdot 1.6875} + \left(1.5 \cdot \frac{c \cdot a}{b} + 1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}}\right)}{a} \]
      2. fma-def97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\color{blue}{\mathsf{fma}\left(\frac{{c}^{3} \cdot {a}^{3}}{{b}^{5}}, 1.6875, 1.5 \cdot \frac{c \cdot a}{b} + 1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}}\right)}}{a} \]
      3. cube-prod97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{\color{blue}{{\left(c \cdot a\right)}^{3}}}{{b}^{5}}, 1.6875, 1.5 \cdot \frac{c \cdot a}{b} + 1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}}\right)}{a} \]
      4. +-commutative97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \color{blue}{1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}} + 1.5 \cdot \frac{c \cdot a}{b}}\right)}{a} \]
      5. *-commutative97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \color{blue}{\frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}} \cdot 1.125} + 1.5 \cdot \frac{c \cdot a}{b}\right)}{a} \]
      6. fma-def97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \color{blue}{\mathsf{fma}\left(\frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}}, 1.125, 1.5 \cdot \frac{c \cdot a}{b}\right)}\right)}{a} \]
      7. unpow297.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{\color{blue}{\left(c \cdot c\right)} \cdot {a}^{2}}{{b}^{3}}, 1.125, 1.5 \cdot \frac{c \cdot a}{b}\right)\right)}{a} \]
      8. associate-*l*97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{\color{blue}{c \cdot \left(c \cdot {a}^{2}\right)}}{{b}^{3}}, 1.125, 1.5 \cdot \frac{c \cdot a}{b}\right)\right)}{a} \]
      9. unpow297.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \color{blue}{\left(a \cdot a\right)}\right)}{{b}^{3}}, 1.125, 1.5 \cdot \frac{c \cdot a}{b}\right)\right)}{a} \]
      10. *-commutative97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, \color{blue}{\frac{c \cdot a}{b} \cdot 1.5}\right)\right)}{a} \]
      11. associate-/l*97.2%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, \color{blue}{\frac{c}{\frac{b}{a}}} \cdot 1.5\right)\right)}{a} \]
    6. Simplified97.2%

      \[\leadsto -0.3333333333333333 \cdot \frac{\color{blue}{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, \frac{c}{\frac{b}{a}} \cdot 1.5\right)\right)}}{a} \]
    7. Step-by-step derivation
      1. associate-*r/97.2%

        \[\leadsto \color{blue}{\frac{-0.3333333333333333 \cdot \mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, \frac{c}{\frac{b}{a}} \cdot 1.5\right)\right)}{a}} \]
      2. *-commutative97.2%

        \[\leadsto \frac{-0.3333333333333333 \cdot \mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, \color{blue}{1.5 \cdot \frac{c}{\frac{b}{a}}}\right)\right)}{a} \]
      3. associate-/r/97.4%

        \[\leadsto \frac{-0.3333333333333333 \cdot \mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, 1.5 \cdot \color{blue}{\left(\frac{c}{b} \cdot a\right)}\right)\right)}{a} \]
    8. Applied egg-rr97.4%

      \[\leadsto \color{blue}{\frac{-0.3333333333333333 \cdot \mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, 1.5 \cdot \left(\frac{c}{b} \cdot a\right)\right)\right)}{a}} \]
    9. Simplified97.4%

      \[\leadsto \color{blue}{\frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(1.5, a \cdot \frac{c}{b}, 1.125 \cdot \left(\left(a \cdot a\right) \cdot \frac{c}{\frac{{b}^{3}}{c}}\right)\right)\right)}}} \]
    10. Step-by-step derivation
      1. unpow397.4%

        \[\leadsto \frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{\color{blue}{\left(\left(c \cdot a\right) \cdot \left(c \cdot a\right)\right) \cdot \left(c \cdot a\right)}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(1.5, a \cdot \frac{c}{b}, 1.125 \cdot \left(\left(a \cdot a\right) \cdot \frac{c}{\frac{{b}^{3}}{c}}\right)\right)\right)}} \]
      2. unswap-sqr97.4%

        \[\leadsto \frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{\color{blue}{\left(\left(c \cdot c\right) \cdot \left(a \cdot a\right)\right)} \cdot \left(c \cdot a\right)}{{b}^{5}}, 1.6875, \mathsf{fma}\left(1.5, a \cdot \frac{c}{b}, 1.125 \cdot \left(\left(a \cdot a\right) \cdot \frac{c}{\frac{{b}^{3}}{c}}\right)\right)\right)}} \]
      3. associate-*r*97.4%

        \[\leadsto \frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{\color{blue}{\left(c \cdot \left(c \cdot \left(a \cdot a\right)\right)\right)} \cdot \left(c \cdot a\right)}{{b}^{5}}, 1.6875, \mathsf{fma}\left(1.5, a \cdot \frac{c}{b}, 1.125 \cdot \left(\left(a \cdot a\right) \cdot \frac{c}{\frac{{b}^{3}}{c}}\right)\right)\right)}} \]
    11. Applied egg-rr97.4%

      \[\leadsto \frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{\color{blue}{\left(c \cdot \left(c \cdot \left(a \cdot a\right)\right)\right) \cdot \left(c \cdot a\right)}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(1.5, a \cdot \frac{c}{b}, 1.125 \cdot \left(\left(a \cdot a\right) \cdot \frac{c}{\frac{{b}^{3}}{c}}\right)\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.002:\\ \;\;\;\;\frac{c \cdot \left(a \cdot -3\right)}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{\left(a \cdot c\right) \cdot \left(c \cdot \left(\left(a \cdot a\right) \cdot c\right)\right)}{{b}^{5}}, 1.6875, \mathsf{fma}\left(1.5, a \cdot \frac{c}{b}, 1.125 \cdot \left(\left(a \cdot a\right) \cdot \frac{c}{\frac{{b}^{3}}{c}}\right)\right)\right)}}\\ \end{array} \]

Alternative 4: 95.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(a \cdot -3\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.002:\\ \;\;\;\;\frac{t_0}{b + \sqrt{\mathsf{fma}\left(b, b, t_0\right)}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{{\left(a \cdot c\right)}^{3}}{{b}^{5}}, 1.6875, 1.5 \cdot \left(a \cdot \frac{c}{b}\right) + 1.125 \cdot \left(a \cdot \left(a \cdot \left(c \cdot \frac{c}{{b}^{3}}\right)\right)\right)\right)}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* c (* a -3.0))))
   (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.002)
     (*
      (/ t_0 (+ b (sqrt (fma b b t_0))))
      (+ (exp (log1p (/ 0.3333333333333333 a))) -1.0))
     (/
      -0.3333333333333333
      (/
       a
       (fma
        (/ (pow (* a c) 3.0) (pow b 5.0))
        1.6875
        (+
         (* 1.5 (* a (/ c b)))
         (* 1.125 (* a (* a (* c (/ c (pow b 3.0)))))))))))))
double code(double a, double b, double c) {
	double t_0 = c * (a * -3.0);
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.002) {
		tmp = (t_0 / (b + sqrt(fma(b, b, t_0)))) * (exp(log1p((0.3333333333333333 / a))) + -1.0);
	} else {
		tmp = -0.3333333333333333 / (a / fma((pow((a * c), 3.0) / pow(b, 5.0)), 1.6875, ((1.5 * (a * (c / b))) + (1.125 * (a * (a * (c * (c / pow(b, 3.0)))))))));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(c * Float64(a * -3.0))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.002)
		tmp = Float64(Float64(t_0 / Float64(b + sqrt(fma(b, b, t_0)))) * Float64(exp(log1p(Float64(0.3333333333333333 / a))) + -1.0));
	else
		tmp = Float64(-0.3333333333333333 / Float64(a / fma(Float64((Float64(a * c) ^ 3.0) / (b ^ 5.0)), 1.6875, Float64(Float64(1.5 * Float64(a * Float64(c / b))) + Float64(1.125 * Float64(a * Float64(a * Float64(c * Float64(c / (b ^ 3.0))))))))));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], -0.002], N[(N[(t$95$0 / N[(b + N[Sqrt[N[(b * b + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[Log[1 + N[(0.3333333333333333 / a), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 / N[(a / N[(N[(N[Power[N[(a * c), $MachinePrecision], 3.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision] * 1.6875 + N[(N[(1.5 * N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.125 * N[(a * N[(a * N[(c * N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := c \cdot \left(a \cdot -3\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.002:\\
\;\;\;\;\frac{t_0}{b + \sqrt{\mathsf{fma}\left(b, b, t_0\right)}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} + -1\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{{\left(a \cdot c\right)}^{3}}{{b}^{5}}, 1.6875, 1.5 \cdot \left(a \cdot \frac{c}{b}\right) + 1.125 \cdot \left(a \cdot \left(a \cdot \left(c \cdot \frac{c}{{b}^{3}}\right)\right)\right)\right)}}\\


\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)) < -2e-3

    1. Initial program 68.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-sub068.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-68.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-neg68.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-168.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/68.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right) - b \cdot b}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} + b}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} - 1\right) \]
    8. Step-by-step derivation
      1. associate-*r*64.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 22.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-identity22.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-eval22.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-/l*22.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -0.3333333333333333 \cdot \frac{\color{blue}{1.6875 \cdot \frac{{c}^{3} \cdot {a}^{3}}{{b}^{5}} + \left(1.5 \cdot \frac{c \cdot a}{b} + 1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}}\right)}}{a} \]
    5. Step-by-step derivation
      1. *-commutative97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\color{blue}{\frac{{c}^{3} \cdot {a}^{3}}{{b}^{5}} \cdot 1.6875} + \left(1.5 \cdot \frac{c \cdot a}{b} + 1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}}\right)}{a} \]
      2. fma-def97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\color{blue}{\mathsf{fma}\left(\frac{{c}^{3} \cdot {a}^{3}}{{b}^{5}}, 1.6875, 1.5 \cdot \frac{c \cdot a}{b} + 1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}}\right)}}{a} \]
      3. cube-prod97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{\color{blue}{{\left(c \cdot a\right)}^{3}}}{{b}^{5}}, 1.6875, 1.5 \cdot \frac{c \cdot a}{b} + 1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}}\right)}{a} \]
      4. +-commutative97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \color{blue}{1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}} + 1.5 \cdot \frac{c \cdot a}{b}}\right)}{a} \]
      5. *-commutative97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \color{blue}{\frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}} \cdot 1.125} + 1.5 \cdot \frac{c \cdot a}{b}\right)}{a} \]
      6. fma-def97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \color{blue}{\mathsf{fma}\left(\frac{{c}^{2} \cdot {a}^{2}}{{b}^{3}}, 1.125, 1.5 \cdot \frac{c \cdot a}{b}\right)}\right)}{a} \]
      7. unpow297.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{\color{blue}{\left(c \cdot c\right)} \cdot {a}^{2}}{{b}^{3}}, 1.125, 1.5 \cdot \frac{c \cdot a}{b}\right)\right)}{a} \]
      8. associate-*l*97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{\color{blue}{c \cdot \left(c \cdot {a}^{2}\right)}}{{b}^{3}}, 1.125, 1.5 \cdot \frac{c \cdot a}{b}\right)\right)}{a} \]
      9. unpow297.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \color{blue}{\left(a \cdot a\right)}\right)}{{b}^{3}}, 1.125, 1.5 \cdot \frac{c \cdot a}{b}\right)\right)}{a} \]
      10. *-commutative97.4%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, \color{blue}{\frac{c \cdot a}{b} \cdot 1.5}\right)\right)}{a} \]
      11. associate-/l*97.2%

        \[\leadsto -0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, \color{blue}{\frac{c}{\frac{b}{a}}} \cdot 1.5\right)\right)}{a} \]
    6. Simplified97.2%

      \[\leadsto -0.3333333333333333 \cdot \frac{\color{blue}{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, \frac{c}{\frac{b}{a}} \cdot 1.5\right)\right)}}{a} \]
    7. Step-by-step derivation
      1. associate-*r/97.2%

        \[\leadsto \color{blue}{\frac{-0.3333333333333333 \cdot \mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, \frac{c}{\frac{b}{a}} \cdot 1.5\right)\right)}{a}} \]
      2. *-commutative97.2%

        \[\leadsto \frac{-0.3333333333333333 \cdot \mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, \color{blue}{1.5 \cdot \frac{c}{\frac{b}{a}}}\right)\right)}{a} \]
      3. associate-/r/97.4%

        \[\leadsto \frac{-0.3333333333333333 \cdot \mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, 1.5 \cdot \color{blue}{\left(\frac{c}{b} \cdot a\right)}\right)\right)}{a} \]
    8. Applied egg-rr97.4%

      \[\leadsto \color{blue}{\frac{-0.3333333333333333 \cdot \mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \mathsf{fma}\left(\frac{c \cdot \left(c \cdot \left(a \cdot a\right)\right)}{{b}^{3}}, 1.125, 1.5 \cdot \left(\frac{c}{b} \cdot a\right)\right)\right)}{a}} \]
    9. Simplified97.4%

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

        \[\leadsto \frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \color{blue}{1.5 \cdot \left(a \cdot \frac{c}{b}\right) + 1.125 \cdot \left(\left(a \cdot a\right) \cdot \frac{c}{\frac{{b}^{3}}{c}}\right)}\right)}} \]
      2. associate-*l*97.3%

        \[\leadsto \frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, 1.5 \cdot \left(a \cdot \frac{c}{b}\right) + 1.125 \cdot \color{blue}{\left(a \cdot \left(a \cdot \frac{c}{\frac{{b}^{3}}{c}}\right)\right)}\right)}} \]
      3. associate-/r/97.3%

        \[\leadsto \frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, 1.5 \cdot \left(a \cdot \frac{c}{b}\right) + 1.125 \cdot \left(a \cdot \left(a \cdot \color{blue}{\left(\frac{c}{{b}^{3}} \cdot c\right)}\right)\right)\right)}} \]
    11. Applied egg-rr97.3%

      \[\leadsto \frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}, 1.6875, \color{blue}{1.5 \cdot \left(a \cdot \frac{c}{b}\right) + 1.125 \cdot \left(a \cdot \left(a \cdot \left(\frac{c}{{b}^{3}} \cdot c\right)\right)\right)}\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.002:\\ \;\;\;\;\frac{c \cdot \left(a \cdot -3\right)}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-0.3333333333333333}{\frac{a}{\mathsf{fma}\left(\frac{{\left(a \cdot c\right)}^{3}}{{b}^{5}}, 1.6875, 1.5 \cdot \left(a \cdot \frac{c}{b}\right) + 1.125 \cdot \left(a \cdot \left(a \cdot \left(c \cdot \frac{c}{{b}^{3}}\right)\right)\right)\right)}}\\ \end{array} \]

Alternative 5: 94.6% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -2.5 \cdot 10^{-6}:\\ \;\;\;\;\left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} + -1\right) \cdot \frac{\left(a \cdot c\right) \cdot -3}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + -0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -2.5e-6)
   (*
    (+ (exp (log1p (/ 0.3333333333333333 a))) -1.0)
    (/ (* (* a c) -3.0) (+ b (sqrt (fma b b (* c (* a -3.0)))))))
   (+ (* -0.5 (/ c b)) (* -0.375 (* a (/ (* c c) (pow b 3.0)))))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -2.5e-6) {
		tmp = (exp(log1p((0.3333333333333333 / a))) + -1.0) * (((a * c) * -3.0) / (b + sqrt(fma(b, b, (c * (a * -3.0))))));
	} else {
		tmp = (-0.5 * (c / b)) + (-0.375 * (a * ((c * c) / pow(b, 3.0))));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -2.5e-6)
		tmp = Float64(Float64(exp(log1p(Float64(0.3333333333333333 / a))) + -1.0) * Float64(Float64(Float64(a * c) * -3.0) / Float64(b + sqrt(fma(b, b, Float64(c * Float64(a * -3.0)))))));
	else
		tmp = Float64(Float64(-0.5 * Float64(c / b)) + Float64(-0.375 * Float64(a * Float64(Float64(c * c) / (b ^ 3.0)))));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], -2.5e-6], N[(N[(N[Exp[N[Log[1 + N[(0.3333333333333333 / a), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision] * N[(N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision] / N[(b + N[Sqrt[N[(b * b + N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(a * N[(N[(c * c), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b} + -0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right)\\


\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)) < -2.5000000000000002e-6

    1. Initial program 66.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. neg-sub066.7%

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

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

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

        \[\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/66.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} \cdot \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b \cdot b}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} + b}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} - 1\right) \]
      2. add-sqr-sqrt62.4%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b \cdot b}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} + b} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} - 1\right) \]
    7. Applied egg-rr62.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right) - b \cdot b}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} + b}} \cdot \left(e^{\mathsf{log1p}\left(\frac{0.3333333333333333}{a}\right)} - 1\right) \]
    8. Step-by-step derivation
      1. associate-*r*62.4%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 19.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. neg-sub019.7%

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

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

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

        \[\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/19.7%

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

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

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

        \[\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. *-commutative19.7%

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

        \[\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/19.7%

        \[\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. Simplified19.8%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}} + -0.5 \cdot \frac{c}{b}} \]
      2. associate-/r/97.2%

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

      \[\leadsto \color{blue}{-0.375 \cdot \left(\frac{c \cdot c}{{b}^{3}} \cdot a\right) + -0.5 \cdot \frac{c}{b}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification95.3%

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

Alternative 6: 90.8% accurate, 1.0× speedup?

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

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

    \[\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-sub031.1%

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

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

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

      \[\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/31.1%

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

      \[\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-eval31.1%

      \[\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-frac31.1%

      \[\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. *-commutative31.1%

      \[\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-frac31.1%

      \[\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/31.1%

      \[\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. Simplified31.2%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}} + -0.5 \cdot \frac{c}{b}} \]
    2. associate-/r/91.9%

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

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

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

Alternative 7: 81.3% accurate, 23.2× speedup?

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

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

    \[\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-sub031.1%

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

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

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

      \[\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/31.1%

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

      \[\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-eval31.1%

      \[\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-frac31.1%

      \[\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. *-commutative31.1%

      \[\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-frac31.1%

      \[\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/31.1%

      \[\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. Simplified31.2%

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

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

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

Reproduce

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