Cubic critical, narrow range

Percentage Accurate: 55.1% → 92.4%
Time: 24.1s
Alternatives: 14
Speedup: 23.2×

Specification

?
\[\left(\left(1.0536712127723509 \cdot 10^{-8} < a \land a < 94906265.62425156\right) \land \left(1.0536712127723509 \cdot 10^{-8} < b \land b < 94906265.62425156\right)\right) \land \left(1.0536712127723509 \cdot 10^{-8} < c \land c < 94906265.62425156\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 14 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: 55.1% accurate, 1.0× speedup?

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

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

Alternative 1: 92.4% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(\sqrt{a}, \sqrt{3 \cdot c}, b\right)\\ t_1 := b - \sqrt{a \cdot \left(3 \cdot c\right)}\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;\frac{0.3333333333333333 \cdot \frac{\mathsf{fma}\left(t\_0, t\_1, -{b}^{2}\right)}{\mathsf{fma}\left(\sqrt{t\_0}, \sqrt{t\_1}, b\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fma (sqrt a) (sqrt (* 3.0 c)) b))
        (t_1 (- b (sqrt (* a (* 3.0 c))))))
   (if (<= (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a)) -6.0)
     (/
      (*
       0.3333333333333333
       (/ (fma t_0 t_1 (- (pow b 2.0))) (fma (sqrt t_0) (sqrt t_1) b)))
      a)
     (+
      (* -0.5 (/ c b))
      (*
       a
       (+
        (* -0.375 (/ (pow c 2.0) (pow b 3.0)))
        (*
         a
         (+
          (* -0.5625 (/ (pow c 3.0) (pow b 5.0)))
          (* -1.0546875 (/ (* a (pow c 4.0)) (pow b 7.0)))))))))))
double code(double a, double b, double c) {
	double t_0 = fma(sqrt(a), sqrt((3.0 * c)), b);
	double t_1 = b - sqrt((a * (3.0 * c)));
	double tmp;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0) {
		tmp = (0.3333333333333333 * (fma(t_0, t_1, -pow(b, 2.0)) / fma(sqrt(t_0), sqrt(t_1), b))) / a;
	} else {
		tmp = (-0.5 * (c / b)) + (a * ((-0.375 * (pow(c, 2.0) / pow(b, 3.0))) + (a * ((-0.5625 * (pow(c, 3.0) / pow(b, 5.0))) + (-1.0546875 * ((a * pow(c, 4.0)) / pow(b, 7.0)))))));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = fma(sqrt(a), sqrt(Float64(3.0 * c)), b)
	t_1 = Float64(b - sqrt(Float64(a * Float64(3.0 * c))))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)) <= -6.0)
		tmp = Float64(Float64(0.3333333333333333 * Float64(fma(t_0, t_1, Float64(-(b ^ 2.0))) / fma(sqrt(t_0), sqrt(t_1), b))) / a);
	else
		tmp = Float64(Float64(-0.5 * Float64(c / b)) + Float64(a * Float64(Float64(-0.375 * Float64((c ^ 2.0) / (b ^ 3.0))) + Float64(a * Float64(Float64(-0.5625 * Float64((c ^ 3.0) / (b ^ 5.0))) + Float64(-1.0546875 * Float64(Float64(a * (c ^ 4.0)) / (b ^ 7.0))))))));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[Sqrt[a], $MachinePrecision] * N[Sqrt[N[(3.0 * c), $MachinePrecision]], $MachinePrecision] + b), $MachinePrecision]}, Block[{t$95$1 = N[(b - N[Sqrt[N[(a * N[(3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], -6.0], N[(N[(0.3333333333333333 * N[(N[(t$95$0 * t$95$1 + (-N[Power[b, 2.0], $MachinePrecision])), $MachinePrecision] / N[(N[Sqrt[t$95$0], $MachinePrecision] * N[Sqrt[t$95$1], $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(-0.375 * N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(-0.5625 * N[(N[Power[c, 3.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0546875 * N[(N[(a * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\sqrt{a}, \sqrt{3 \cdot c}, b\right)\\
t_1 := b - \sqrt{a \cdot \left(3 \cdot c\right)}\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\
\;\;\;\;\frac{0.3333333333333333 \cdot \frac{\mathsf{fma}\left(t\_0, t\_1, -{b}^{2}\right)}{\mathsf{fma}\left(\sqrt{t\_0}, \sqrt{t\_1}, b\right)}}{a}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\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 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -6

    1. Initial program 85.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-sub085.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{\sqrt{\left(b + \sqrt{a \cdot c} \cdot \sqrt{3}\right) \cdot \left(b - \sqrt{a \cdot c} \cdot \sqrt{3}\right)} - b}{a}} \]
    10. Step-by-step derivation
      1. associate-*r/85.6%

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

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

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

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

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

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

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

    if -6 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

    1. Initial program 49.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg49.4%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;\frac{0.3333333333333333 \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{a}, \sqrt{3 \cdot c}, b\right), b - \sqrt{a \cdot \left(3 \cdot c\right)}, -{b}^{2}\right)}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\sqrt{a}, \sqrt{3 \cdot c}, b\right)}, \sqrt{b - \sqrt{a \cdot \left(3 \cdot c\right)}}, b\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 92.3% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := b - \sqrt{a \cdot \left(3 \cdot c\right)}\\ t_1 := \mathsf{fma}\left(\sqrt{a}, \sqrt{3 \cdot c}, b\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;\frac{0.3333333333333333 \cdot \frac{t\_0 \cdot t\_1 - {b}^{2}}{\mathsf{fma}\left(\sqrt{t\_1}, \sqrt{t\_0}, b\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (- b (sqrt (* a (* 3.0 c)))))
        (t_1 (fma (sqrt a) (sqrt (* 3.0 c)) b)))
   (if (<= (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a)) -6.0)
     (/
      (*
       0.3333333333333333
       (/ (- (* t_0 t_1) (pow b 2.0)) (fma (sqrt t_1) (sqrt t_0) b)))
      a)
     (+
      (* -0.5 (/ c b))
      (*
       a
       (+
        (* -0.375 (/ (pow c 2.0) (pow b 3.0)))
        (*
         a
         (+
          (* -0.5625 (/ (pow c 3.0) (pow b 5.0)))
          (* -1.0546875 (/ (* a (pow c 4.0)) (pow b 7.0)))))))))))
double code(double a, double b, double c) {
	double t_0 = b - sqrt((a * (3.0 * c)));
	double t_1 = fma(sqrt(a), sqrt((3.0 * c)), b);
	double tmp;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0) {
		tmp = (0.3333333333333333 * (((t_0 * t_1) - pow(b, 2.0)) / fma(sqrt(t_1), sqrt(t_0), b))) / a;
	} else {
		tmp = (-0.5 * (c / b)) + (a * ((-0.375 * (pow(c, 2.0) / pow(b, 3.0))) + (a * ((-0.5625 * (pow(c, 3.0) / pow(b, 5.0))) + (-1.0546875 * ((a * pow(c, 4.0)) / pow(b, 7.0)))))));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(b - sqrt(Float64(a * Float64(3.0 * c))))
	t_1 = fma(sqrt(a), sqrt(Float64(3.0 * c)), b)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)) <= -6.0)
		tmp = Float64(Float64(0.3333333333333333 * Float64(Float64(Float64(t_0 * t_1) - (b ^ 2.0)) / fma(sqrt(t_1), sqrt(t_0), b))) / a);
	else
		tmp = Float64(Float64(-0.5 * Float64(c / b)) + Float64(a * Float64(Float64(-0.375 * Float64((c ^ 2.0) / (b ^ 3.0))) + Float64(a * Float64(Float64(-0.5625 * Float64((c ^ 3.0) / (b ^ 5.0))) + Float64(-1.0546875 * Float64(Float64(a * (c ^ 4.0)) / (b ^ 7.0))))))));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(b - N[Sqrt[N[(a * N[(3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[a], $MachinePrecision] * N[Sqrt[N[(3.0 * c), $MachinePrecision]], $MachinePrecision] + b), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], -6.0], N[(N[(0.3333333333333333 * N[(N[(N[(t$95$0 * t$95$1), $MachinePrecision] - N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[t$95$1], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(-0.375 * N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(-0.5625 * N[(N[Power[c, 3.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0546875 * N[(N[(a * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := b - \sqrt{a \cdot \left(3 \cdot c\right)}\\
t_1 := \mathsf{fma}\left(\sqrt{a}, \sqrt{3 \cdot c}, b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\
\;\;\;\;\frac{0.3333333333333333 \cdot \frac{t\_0 \cdot t\_1 - {b}^{2}}{\mathsf{fma}\left(\sqrt{t\_1}, \sqrt{t\_0}, b\right)}}{a}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\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 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -6

    1. Initial program 85.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-sub085.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{\sqrt{\left(b + \sqrt{a \cdot c} \cdot \sqrt{3}\right) \cdot \left(b - \sqrt{a \cdot c} \cdot \sqrt{3}\right)} - b}{a}} \]
    10. Step-by-step derivation
      1. associate-*r/85.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -6 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

    1. Initial program 49.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg49.4%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;\frac{0.3333333333333333 \cdot \frac{\left(b - \sqrt{a \cdot \left(3 \cdot c\right)}\right) \cdot \mathsf{fma}\left(\sqrt{a}, \sqrt{3 \cdot c}, b\right) - {b}^{2}}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\sqrt{a}, \sqrt{3 \cdot c}, b\right)}, \sqrt{b - \sqrt{a \cdot \left(3 \cdot c\right)}}, b\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 92.3% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(b - \sqrt{a \cdot \left(3 \cdot c\right)}\right) \cdot \mathsf{fma}\left(\sqrt{a \cdot c}, \sqrt{3}, b\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;\frac{\frac{t\_0 - {b}^{2}}{b + \sqrt{t\_0}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0
         (* (- b (sqrt (* a (* 3.0 c)))) (fma (sqrt (* a c)) (sqrt 3.0) b))))
   (if (<= (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a)) -6.0)
     (/ (/ (- t_0 (pow b 2.0)) (+ b (sqrt t_0))) (* 3.0 a))
     (+
      (* -0.5 (/ c b))
      (*
       a
       (+
        (* -0.375 (/ (pow c 2.0) (pow b 3.0)))
        (*
         a
         (+
          (* -0.5625 (/ (pow c 3.0) (pow b 5.0)))
          (* -1.0546875 (/ (* a (pow c 4.0)) (pow b 7.0)))))))))))
double code(double a, double b, double c) {
	double t_0 = (b - sqrt((a * (3.0 * c)))) * fma(sqrt((a * c)), sqrt(3.0), b);
	double tmp;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0) {
		tmp = ((t_0 - pow(b, 2.0)) / (b + sqrt(t_0))) / (3.0 * a);
	} else {
		tmp = (-0.5 * (c / b)) + (a * ((-0.375 * (pow(c, 2.0) / pow(b, 3.0))) + (a * ((-0.5625 * (pow(c, 3.0) / pow(b, 5.0))) + (-1.0546875 * ((a * pow(c, 4.0)) / pow(b, 7.0)))))));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(Float64(b - sqrt(Float64(a * Float64(3.0 * c)))) * fma(sqrt(Float64(a * c)), sqrt(3.0), b))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)) <= -6.0)
		tmp = Float64(Float64(Float64(t_0 - (b ^ 2.0)) / Float64(b + sqrt(t_0))) / Float64(3.0 * a));
	else
		tmp = Float64(Float64(-0.5 * Float64(c / b)) + Float64(a * Float64(Float64(-0.375 * Float64((c ^ 2.0) / (b ^ 3.0))) + Float64(a * Float64(Float64(-0.5625 * Float64((c ^ 3.0) / (b ^ 5.0))) + Float64(-1.0546875 * Float64(Float64(a * (c ^ 4.0)) / (b ^ 7.0))))))));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(b - N[Sqrt[N[(a * N[(3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(a * c), $MachinePrecision]], $MachinePrecision] * N[Sqrt[3.0], $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], -6.0], N[(N[(N[(t$95$0 - N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(-0.375 * N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(-0.5625 * N[(N[Power[c, 3.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0546875 * N[(N[(a * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(b - \sqrt{a \cdot \left(3 \cdot c\right)}\right) \cdot \mathsf{fma}\left(\sqrt{a \cdot c}, \sqrt{3}, b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\
\;\;\;\;\frac{\frac{t\_0 - {b}^{2}}{b + \sqrt{t\_0}}}{3 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\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 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -6

    1. Initial program 85.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-sub085.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

    1. Initial program 49.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg49.4%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;\frac{\frac{\left(b - \sqrt{a \cdot \left(3 \cdot c\right)}\right) \cdot \mathsf{fma}\left(\sqrt{a \cdot c}, \sqrt{3}, b\right) - {b}^{2}}{b + \sqrt{\left(b - \sqrt{a \cdot \left(3 \cdot c\right)}\right) \cdot \mathsf{fma}\left(\sqrt{a \cdot c}, \sqrt{3}, b\right)}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 92.3% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{a \cdot \left(3 \cdot c\right)}\\ t_1 := 0.3333333333333333 \cdot \frac{\sqrt{\left(b - t\_0\right) \cdot \left(b + t\_0\right)} - b}{a}\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;\sqrt[3]{t\_1} \cdot \sqrt[3]{{t\_1}^{2}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (* a (* 3.0 c))))
        (t_1
         (* 0.3333333333333333 (/ (- (sqrt (* (- b t_0) (+ b t_0))) b) a))))
   (if (<= (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a)) -6.0)
     (* (cbrt t_1) (cbrt (pow t_1 2.0)))
     (+
      (* -0.5 (/ c b))
      (*
       a
       (+
        (* -0.375 (/ (pow c 2.0) (pow b 3.0)))
        (*
         a
         (+
          (* -0.5625 (/ (pow c 3.0) (pow b 5.0)))
          (* -1.0546875 (/ (* a (pow c 4.0)) (pow b 7.0)))))))))))
double code(double a, double b, double c) {
	double t_0 = sqrt((a * (3.0 * c)));
	double t_1 = 0.3333333333333333 * ((sqrt(((b - t_0) * (b + t_0))) - b) / a);
	double tmp;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0) {
		tmp = cbrt(t_1) * cbrt(pow(t_1, 2.0));
	} else {
		tmp = (-0.5 * (c / b)) + (a * ((-0.375 * (pow(c, 2.0) / pow(b, 3.0))) + (a * ((-0.5625 * (pow(c, 3.0) / pow(b, 5.0))) + (-1.0546875 * ((a * pow(c, 4.0)) / pow(b, 7.0)))))));
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt((a * (3.0 * c)));
	double t_1 = 0.3333333333333333 * ((Math.sqrt(((b - t_0) * (b + t_0))) - b) / a);
	double tmp;
	if (((Math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0) {
		tmp = Math.cbrt(t_1) * Math.cbrt(Math.pow(t_1, 2.0));
	} else {
		tmp = (-0.5 * (c / b)) + (a * ((-0.375 * (Math.pow(c, 2.0) / Math.pow(b, 3.0))) + (a * ((-0.5625 * (Math.pow(c, 3.0) / Math.pow(b, 5.0))) + (-1.0546875 * ((a * Math.pow(c, 4.0)) / Math.pow(b, 7.0)))))));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = sqrt(Float64(a * Float64(3.0 * c)))
	t_1 = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(Float64(b - t_0) * Float64(b + t_0))) - b) / a))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)) <= -6.0)
		tmp = Float64(cbrt(t_1) * cbrt((t_1 ^ 2.0)));
	else
		tmp = Float64(Float64(-0.5 * Float64(c / b)) + Float64(a * Float64(Float64(-0.375 * Float64((c ^ 2.0) / (b ^ 3.0))) + Float64(a * Float64(Float64(-0.5625 * Float64((c ^ 3.0) / (b ^ 5.0))) + Float64(-1.0546875 * Float64(Float64(a * (c ^ 4.0)) / (b ^ 7.0))))))));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(a * N[(3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(N[(b - t$95$0), $MachinePrecision] * N[(b + t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], -6.0], N[(N[Power[t$95$1, 1/3], $MachinePrecision] * N[Power[N[Power[t$95$1, 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(-0.375 * N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(-0.5625 * N[(N[Power[c, 3.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0546875 * N[(N[(a * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{a \cdot \left(3 \cdot c\right)}\\
t_1 := 0.3333333333333333 \cdot \frac{\sqrt{\left(b - t\_0\right) \cdot \left(b + t\_0\right)} - b}{a}\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\
\;\;\;\;\sqrt[3]{t\_1} \cdot \sqrt[3]{{t\_1}^{2}}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\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 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -6

    1. Initial program 85.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-sub085.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

    1. Initial program 49.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg49.4%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;\sqrt[3]{0.3333333333333333 \cdot \frac{\sqrt{\left(b - \sqrt{a \cdot \left(3 \cdot c\right)}\right) \cdot \left(b + \sqrt{a \cdot \left(3 \cdot c\right)}\right)} - b}{a}} \cdot \sqrt[3]{{\left(0.3333333333333333 \cdot \frac{\sqrt{\left(b - \sqrt{a \cdot \left(3 \cdot c\right)}\right) \cdot \left(b + \sqrt{a \cdot \left(3 \cdot c\right)}\right)} - b}{a}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 92.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{a \cdot \left(3 \cdot c\right)}\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(b - t\_0\right) \cdot \left(b + t\_0\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (* a (* 3.0 c)))))
   (if (<= (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a)) -6.0)
     (* 0.3333333333333333 (/ (- (sqrt (* (- b t_0) (+ b t_0))) b) a))
     (+
      (* -0.5 (/ c b))
      (*
       a
       (+
        (* -0.375 (/ (pow c 2.0) (pow b 3.0)))
        (*
         a
         (+
          (* -0.5625 (/ (pow c 3.0) (pow b 5.0)))
          (* -1.0546875 (/ (* a (pow c 4.0)) (pow b 7.0)))))))))))
double code(double a, double b, double c) {
	double t_0 = sqrt((a * (3.0 * c)));
	double tmp;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0) {
		tmp = 0.3333333333333333 * ((sqrt(((b - t_0) * (b + t_0))) - b) / a);
	} else {
		tmp = (-0.5 * (c / b)) + (a * ((-0.375 * (pow(c, 2.0) / pow(b, 3.0))) + (a * ((-0.5625 * (pow(c, 3.0) / pow(b, 5.0))) + (-1.0546875 * ((a * pow(c, 4.0)) / pow(b, 7.0)))))));
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt((a * (3.0d0 * c)))
    if (((sqrt(((b * b) - ((3.0d0 * a) * c))) - b) / (3.0d0 * a)) <= (-6.0d0)) then
        tmp = 0.3333333333333333d0 * ((sqrt(((b - t_0) * (b + t_0))) - b) / a)
    else
        tmp = ((-0.5d0) * (c / b)) + (a * (((-0.375d0) * ((c ** 2.0d0) / (b ** 3.0d0))) + (a * (((-0.5625d0) * ((c ** 3.0d0) / (b ** 5.0d0))) + ((-1.0546875d0) * ((a * (c ** 4.0d0)) / (b ** 7.0d0)))))))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt((a * (3.0 * c)));
	double tmp;
	if (((Math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0) {
		tmp = 0.3333333333333333 * ((Math.sqrt(((b - t_0) * (b + t_0))) - b) / a);
	} else {
		tmp = (-0.5 * (c / b)) + (a * ((-0.375 * (Math.pow(c, 2.0) / Math.pow(b, 3.0))) + (a * ((-0.5625 * (Math.pow(c, 3.0) / Math.pow(b, 5.0))) + (-1.0546875 * ((a * Math.pow(c, 4.0)) / Math.pow(b, 7.0)))))));
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt((a * (3.0 * c)))
	tmp = 0
	if ((math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0:
		tmp = 0.3333333333333333 * ((math.sqrt(((b - t_0) * (b + t_0))) - b) / a)
	else:
		tmp = (-0.5 * (c / b)) + (a * ((-0.375 * (math.pow(c, 2.0) / math.pow(b, 3.0))) + (a * ((-0.5625 * (math.pow(c, 3.0) / math.pow(b, 5.0))) + (-1.0546875 * ((a * math.pow(c, 4.0)) / math.pow(b, 7.0)))))))
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(a * Float64(3.0 * c)))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)) <= -6.0)
		tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(Float64(b - t_0) * Float64(b + t_0))) - b) / a));
	else
		tmp = Float64(Float64(-0.5 * Float64(c / b)) + Float64(a * Float64(Float64(-0.375 * Float64((c ^ 2.0) / (b ^ 3.0))) + Float64(a * Float64(Float64(-0.5625 * Float64((c ^ 3.0) / (b ^ 5.0))) + Float64(-1.0546875 * Float64(Float64(a * (c ^ 4.0)) / (b ^ 7.0))))))));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = sqrt((a * (3.0 * c)));
	tmp = 0.0;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0)
		tmp = 0.3333333333333333 * ((sqrt(((b - t_0) * (b + t_0))) - b) / a);
	else
		tmp = (-0.5 * (c / b)) + (a * ((-0.375 * ((c ^ 2.0) / (b ^ 3.0))) + (a * ((-0.5625 * ((c ^ 3.0) / (b ^ 5.0))) + (-1.0546875 * ((a * (c ^ 4.0)) / (b ^ 7.0)))))));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(a * N[(3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], -6.0], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(N[(b - t$95$0), $MachinePrecision] * N[(b + t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(-0.375 * N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(-0.5625 * N[(N[Power[c, 3.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0546875 * N[(N[(a * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{a \cdot \left(3 \cdot c\right)}\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(b - t\_0\right) \cdot \left(b + t\_0\right)} - b}{a}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\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 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -6

    1. Initial program 85.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-sub085.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, b, \sqrt{\left({\left(c \cdot a\right)}^{0.5} \cdot \color{blue}{{3}^{0.5}} + b\right) \cdot \left(b - \sqrt{a \cdot \left(c \cdot 3\right)}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      6. unpow-prod-down85.7%

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

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

        \[\leadsto \mathsf{fma}\left(-1, b, \sqrt{\left({\color{blue}{\left(a \cdot \left(c \cdot 3\right)\right)}}^{0.5} + b\right) \cdot \left(b - \sqrt{a \cdot \left(c \cdot 3\right)}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      9. pow1/285.6%

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

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

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

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

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

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

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

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

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

    if -6 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

    1. Initial program 49.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg49.4%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(b - \sqrt{a \cdot \left(3 \cdot c\right)}\right) \cdot \left(b + \sqrt{a \cdot \left(3 \cdot c\right)}\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-0.5625 \cdot \frac{{c}^{3}}{{b}^{5}} + -1.0546875 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 89.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{a \cdot \left(3 \cdot c\right)}\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(b - t\_0\right) \cdot \left(b + t\_0\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + -0.5625 \cdot \frac{a \cdot {c}^{3}}{{b}^{5}}\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (* a (* 3.0 c)))))
   (if (<= (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a)) -6.0)
     (* 0.3333333333333333 (/ (- (sqrt (* (- b t_0) (+ b t_0))) b) a))
     (+
      (* -0.5 (/ c b))
      (*
       a
       (+
        (* -0.375 (/ (pow c 2.0) (pow b 3.0)))
        (* -0.5625 (/ (* a (pow c 3.0)) (pow b 5.0)))))))))
double code(double a, double b, double c) {
	double t_0 = sqrt((a * (3.0 * c)));
	double tmp;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0) {
		tmp = 0.3333333333333333 * ((sqrt(((b - t_0) * (b + t_0))) - b) / a);
	} else {
		tmp = (-0.5 * (c / b)) + (a * ((-0.375 * (pow(c, 2.0) / pow(b, 3.0))) + (-0.5625 * ((a * pow(c, 3.0)) / pow(b, 5.0)))));
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt((a * (3.0d0 * c)))
    if (((sqrt(((b * b) - ((3.0d0 * a) * c))) - b) / (3.0d0 * a)) <= (-6.0d0)) then
        tmp = 0.3333333333333333d0 * ((sqrt(((b - t_0) * (b + t_0))) - b) / a)
    else
        tmp = ((-0.5d0) * (c / b)) + (a * (((-0.375d0) * ((c ** 2.0d0) / (b ** 3.0d0))) + ((-0.5625d0) * ((a * (c ** 3.0d0)) / (b ** 5.0d0)))))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt((a * (3.0 * c)));
	double tmp;
	if (((Math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0) {
		tmp = 0.3333333333333333 * ((Math.sqrt(((b - t_0) * (b + t_0))) - b) / a);
	} else {
		tmp = (-0.5 * (c / b)) + (a * ((-0.375 * (Math.pow(c, 2.0) / Math.pow(b, 3.0))) + (-0.5625 * ((a * Math.pow(c, 3.0)) / Math.pow(b, 5.0)))));
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt((a * (3.0 * c)))
	tmp = 0
	if ((math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0:
		tmp = 0.3333333333333333 * ((math.sqrt(((b - t_0) * (b + t_0))) - b) / a)
	else:
		tmp = (-0.5 * (c / b)) + (a * ((-0.375 * (math.pow(c, 2.0) / math.pow(b, 3.0))) + (-0.5625 * ((a * math.pow(c, 3.0)) / math.pow(b, 5.0)))))
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(a * Float64(3.0 * c)))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)) <= -6.0)
		tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(Float64(b - t_0) * Float64(b + t_0))) - b) / a));
	else
		tmp = Float64(Float64(-0.5 * Float64(c / b)) + Float64(a * Float64(Float64(-0.375 * Float64((c ^ 2.0) / (b ^ 3.0))) + Float64(-0.5625 * Float64(Float64(a * (c ^ 3.0)) / (b ^ 5.0))))));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = sqrt((a * (3.0 * c)));
	tmp = 0.0;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0)
		tmp = 0.3333333333333333 * ((sqrt(((b - t_0) * (b + t_0))) - b) / a);
	else
		tmp = (-0.5 * (c / b)) + (a * ((-0.375 * ((c ^ 2.0) / (b ^ 3.0))) + (-0.5625 * ((a * (c ^ 3.0)) / (b ^ 5.0)))));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(a * N[(3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], -6.0], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(N[(b - t$95$0), $MachinePrecision] * N[(b + t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(-0.375 * N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5625 * N[(N[(a * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{a \cdot \left(3 \cdot c\right)}\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(b - t\_0\right) \cdot \left(b + t\_0\right)} - b}{a}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + -0.5625 \cdot \frac{a \cdot {c}^{3}}{{b}^{5}}\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 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -6

    1. Initial program 85.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-sub085.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, b, \sqrt{\left({\left(c \cdot a\right)}^{0.5} \cdot \color{blue}{{3}^{0.5}} + b\right) \cdot \left(b - \sqrt{a \cdot \left(c \cdot 3\right)}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      6. unpow-prod-down85.7%

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

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

        \[\leadsto \mathsf{fma}\left(-1, b, \sqrt{\left({\color{blue}{\left(a \cdot \left(c \cdot 3\right)\right)}}^{0.5} + b\right) \cdot \left(b - \sqrt{a \cdot \left(c \cdot 3\right)}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      9. pow1/285.6%

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

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

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

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

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

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

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

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

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

    if -6 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

    1. Initial program 49.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg49.4%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(b - \sqrt{a \cdot \left(3 \cdot c\right)}\right) \cdot \left(b + \sqrt{a \cdot \left(3 \cdot c\right)}\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b} + a \cdot \left(-0.375 \cdot \frac{{c}^{2}}{{b}^{3}} + -0.5625 \cdot \frac{a \cdot {c}^{3}}{{b}^{5}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 89.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{a \cdot \left(3 \cdot c\right)}\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(b - t\_0\right) \cdot \left(b + t\_0\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(c \cdot \left(-0.5625 \cdot \frac{c \cdot {a}^{2}}{{b}^{5}} + -0.375 \cdot \frac{a}{{b}^{3}}\right) + 0.5 \cdot \frac{-1}{b}\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (* a (* 3.0 c)))))
   (if (<= (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a)) -6.0)
     (* 0.3333333333333333 (/ (- (sqrt (* (- b t_0) (+ b t_0))) b) a))
     (*
      c
      (+
       (*
        c
        (+
         (* -0.5625 (/ (* c (pow a 2.0)) (pow b 5.0)))
         (* -0.375 (/ a (pow b 3.0)))))
       (* 0.5 (/ -1.0 b)))))))
double code(double a, double b, double c) {
	double t_0 = sqrt((a * (3.0 * c)));
	double tmp;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0) {
		tmp = 0.3333333333333333 * ((sqrt(((b - t_0) * (b + t_0))) - b) / a);
	} else {
		tmp = c * ((c * ((-0.5625 * ((c * pow(a, 2.0)) / pow(b, 5.0))) + (-0.375 * (a / pow(b, 3.0))))) + (0.5 * (-1.0 / b)));
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt((a * (3.0d0 * c)))
    if (((sqrt(((b * b) - ((3.0d0 * a) * c))) - b) / (3.0d0 * a)) <= (-6.0d0)) then
        tmp = 0.3333333333333333d0 * ((sqrt(((b - t_0) * (b + t_0))) - b) / a)
    else
        tmp = c * ((c * (((-0.5625d0) * ((c * (a ** 2.0d0)) / (b ** 5.0d0))) + ((-0.375d0) * (a / (b ** 3.0d0))))) + (0.5d0 * ((-1.0d0) / b)))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt((a * (3.0 * c)));
	double tmp;
	if (((Math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0) {
		tmp = 0.3333333333333333 * ((Math.sqrt(((b - t_0) * (b + t_0))) - b) / a);
	} else {
		tmp = c * ((c * ((-0.5625 * ((c * Math.pow(a, 2.0)) / Math.pow(b, 5.0))) + (-0.375 * (a / Math.pow(b, 3.0))))) + (0.5 * (-1.0 / b)));
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt((a * (3.0 * c)))
	tmp = 0
	if ((math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0:
		tmp = 0.3333333333333333 * ((math.sqrt(((b - t_0) * (b + t_0))) - b) / a)
	else:
		tmp = c * ((c * ((-0.5625 * ((c * math.pow(a, 2.0)) / math.pow(b, 5.0))) + (-0.375 * (a / math.pow(b, 3.0))))) + (0.5 * (-1.0 / b)))
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(a * Float64(3.0 * c)))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)) <= -6.0)
		tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(Float64(b - t_0) * Float64(b + t_0))) - b) / a));
	else
		tmp = Float64(c * Float64(Float64(c * Float64(Float64(-0.5625 * Float64(Float64(c * (a ^ 2.0)) / (b ^ 5.0))) + Float64(-0.375 * Float64(a / (b ^ 3.0))))) + Float64(0.5 * Float64(-1.0 / b))));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = sqrt((a * (3.0 * c)));
	tmp = 0.0;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -6.0)
		tmp = 0.3333333333333333 * ((sqrt(((b - t_0) * (b + t_0))) - b) / a);
	else
		tmp = c * ((c * ((-0.5625 * ((c * (a ^ 2.0)) / (b ^ 5.0))) + (-0.375 * (a / (b ^ 3.0))))) + (0.5 * (-1.0 / b)));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(a * N[(3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], -6.0], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(N[(b - t$95$0), $MachinePrecision] * N[(b + t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(c * N[(N[(-0.5625 * N[(N[(c * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{a \cdot \left(3 \cdot c\right)}\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(b - t\_0\right) \cdot \left(b + t\_0\right)} - b}{a}\\

\mathbf{else}:\\
\;\;\;\;c \cdot \left(c \cdot \left(-0.5625 \cdot \frac{c \cdot {a}^{2}}{{b}^{5}} + -0.375 \cdot \frac{a}{{b}^{3}}\right) + 0.5 \cdot \frac{-1}{b}\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 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -6

    1. Initial program 85.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-sub085.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, b, \sqrt{\left({\left(c \cdot a\right)}^{0.5} \cdot \color{blue}{{3}^{0.5}} + b\right) \cdot \left(b - \sqrt{a \cdot \left(c \cdot 3\right)}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      6. unpow-prod-down85.7%

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

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

        \[\leadsto \mathsf{fma}\left(-1, b, \sqrt{\left({\color{blue}{\left(a \cdot \left(c \cdot 3\right)\right)}}^{0.5} + b\right) \cdot \left(b - \sqrt{a \cdot \left(c \cdot 3\right)}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      9. pow1/285.6%

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

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

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

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

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

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

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

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

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

    if -6 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

    1. Initial program 49.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg49.4%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -6:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(b - \sqrt{a \cdot \left(3 \cdot c\right)}\right) \cdot \left(b + \sqrt{a \cdot \left(3 \cdot c\right)}\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(c \cdot \left(-0.5625 \cdot \frac{c \cdot {a}^{2}}{{b}^{5}} + -0.375 \cdot \frac{a}{{b}^{3}}\right) + 0.5 \cdot \frac{-1}{b}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 85.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{a \cdot \left(3 \cdot c\right)}\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -0.035:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(b - t\_0\right) \cdot \left(b + t\_0\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a \cdot \frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (* a (* 3.0 c)))))
   (if (<= (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a)) -0.035)
     (* 0.3333333333333333 (/ (- (sqrt (* (- b t_0) (+ b t_0))) b) a))
     (/ 1.0 (* a (/ (+ (* -2.0 (/ b c)) (* 1.5 (/ a b))) a))))))
double code(double a, double b, double c) {
	double t_0 = sqrt((a * (3.0 * c)));
	double tmp;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -0.035) {
		tmp = 0.3333333333333333 * ((sqrt(((b - t_0) * (b + t_0))) - b) / a);
	} else {
		tmp = 1.0 / (a * (((-2.0 * (b / c)) + (1.5 * (a / b))) / a));
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt((a * (3.0d0 * c)))
    if (((sqrt(((b * b) - ((3.0d0 * a) * c))) - b) / (3.0d0 * a)) <= (-0.035d0)) then
        tmp = 0.3333333333333333d0 * ((sqrt(((b - t_0) * (b + t_0))) - b) / a)
    else
        tmp = 1.0d0 / (a * ((((-2.0d0) * (b / c)) + (1.5d0 * (a / b))) / a))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt((a * (3.0 * c)));
	double tmp;
	if (((Math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -0.035) {
		tmp = 0.3333333333333333 * ((Math.sqrt(((b - t_0) * (b + t_0))) - b) / a);
	} else {
		tmp = 1.0 / (a * (((-2.0 * (b / c)) + (1.5 * (a / b))) / a));
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt((a * (3.0 * c)))
	tmp = 0
	if ((math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -0.035:
		tmp = 0.3333333333333333 * ((math.sqrt(((b - t_0) * (b + t_0))) - b) / a)
	else:
		tmp = 1.0 / (a * (((-2.0 * (b / c)) + (1.5 * (a / b))) / a))
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(a * Float64(3.0 * c)))
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)) <= -0.035)
		tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(Float64(b - t_0) * Float64(b + t_0))) - b) / a));
	else
		tmp = Float64(1.0 / Float64(a * Float64(Float64(Float64(-2.0 * Float64(b / c)) + Float64(1.5 * Float64(a / b))) / a)));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = sqrt((a * (3.0 * c)));
	tmp = 0.0;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -0.035)
		tmp = 0.3333333333333333 * ((sqrt(((b - t_0) * (b + t_0))) - b) / a);
	else
		tmp = 1.0 / (a * (((-2.0 * (b / c)) + (1.5 * (a / b))) / a));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(a * N[(3.0 * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], -0.035], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(N[(b - t$95$0), $MachinePrecision] * N[(b + t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(a * N[(N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{a \cdot \left(3 \cdot c\right)}\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -0.035:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(b - t\_0\right) \cdot \left(b + t\_0\right)} - b}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}\\


\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 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -0.035000000000000003

    1. Initial program 79.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg79.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-1, b, \sqrt{\left({\color{blue}{\left(a \cdot \left(c \cdot 3\right)\right)}}^{0.5} + b\right) \cdot \left(b - \sqrt{a \cdot \left(c \cdot 3\right)}\right)}\right) \cdot \frac{1}{3 \cdot a} \]
      9. pow1/279.6%

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

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

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

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

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

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

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

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

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

    if -0.035000000000000003 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

    1. Initial program 45.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{c \cdot \left(-1.5 \cdot \frac{a}{b} + -1.125 \cdot \frac{{a}^{2} \cdot c}{{b}^{3}}\right)}}{3 \cdot a} \]
    6. Step-by-step derivation
      1. clear-num88.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 3}{c \cdot \mathsf{fma}\left(-1.125, {a}^{2} \cdot \frac{c}{{b}^{3}}, -1.5 \cdot \frac{a}{b}\right)}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. unpow-188.3%

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

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

      \[\leadsto \color{blue}{\frac{1}{a \cdot \frac{3}{c \cdot \mathsf{fma}\left(-1.125, {a}^{2} \cdot \frac{c}{{b}^{3}}, -1.5 \cdot \frac{a}{b}\right)}}} \]
    10. Taylor expanded in a around 0 89.0%

      \[\leadsto \frac{1}{a \cdot \color{blue}{\frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -0.035:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\left(b - \sqrt{a \cdot \left(3 \cdot c\right)}\right) \cdot \left(b + \sqrt{a \cdot \left(3 \cdot c\right)}\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a \cdot \frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 85.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -0.035:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a \cdot \frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a)) -0.035)
   (/ (- (sqrt (fma b b (* a (* c -3.0)))) b) (* 3.0 a))
   (/ 1.0 (* a (/ (+ (* -2.0 (/ b c)) (* 1.5 (/ a b))) a)))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -0.035) {
		tmp = (sqrt(fma(b, b, (a * (c * -3.0)))) - b) / (3.0 * a);
	} else {
		tmp = 1.0 / (a * (((-2.0 * (b / c)) + (1.5 * (a / b))) / a));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)) <= -0.035)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(c * -3.0)))) - b) / Float64(3.0 * a));
	else
		tmp = Float64(1.0 / Float64(a * Float64(Float64(Float64(-2.0 * Float64(b / c)) + Float64(1.5 * Float64(a / b))) / a)));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], -0.035], N[(N[(N[Sqrt[N[(b * b + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(a * N[(N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}\\


\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 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -0.035000000000000003

    1. Initial program 79.4%

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

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

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

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

    if -0.035000000000000003 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

    1. Initial program 45.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{c \cdot \left(-1.5 \cdot \frac{a}{b} + -1.125 \cdot \frac{{a}^{2} \cdot c}{{b}^{3}}\right)}}{3 \cdot a} \]
    6. Step-by-step derivation
      1. clear-num88.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 3}{c \cdot \mathsf{fma}\left(-1.125, {a}^{2} \cdot \frac{c}{{b}^{3}}, -1.5 \cdot \frac{a}{b}\right)}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. unpow-188.3%

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

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

      \[\leadsto \color{blue}{\frac{1}{a \cdot \frac{3}{c \cdot \mathsf{fma}\left(-1.125, {a}^{2} \cdot \frac{c}{{b}^{3}}, -1.5 \cdot \frac{a}{b}\right)}}} \]
    10. Taylor expanded in a around 0 89.0%

      \[\leadsto \frac{1}{a \cdot \color{blue}{\frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -0.035:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a \cdot \frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 85.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -0.035:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a \cdot \frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a)) -0.035)
   (/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* 3.0 a))
   (/ 1.0 (* a (/ (+ (* -2.0 (/ b c)) (* 1.5 (/ a b))) a)))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -0.035) {
		tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a);
	} else {
		tmp = 1.0 / (a * (((-2.0 * (b / c)) + (1.5 * (a / b))) / a));
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (((sqrt(((b * b) - ((3.0d0 * a) * c))) - b) / (3.0d0 * a)) <= (-0.035d0)) then
        tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (3.0d0 * a)
    else
        tmp = 1.0d0 / (a * ((((-2.0d0) * (b / c)) + (1.5d0 * (a / b))) / a))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (((Math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -0.035) {
		tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a);
	} else {
		tmp = 1.0 / (a * (((-2.0 * (b / c)) + (1.5 * (a / b))) / a));
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if ((math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -0.035:
		tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a)
	else:
		tmp = 1.0 / (a * (((-2.0 * (b / c)) + (1.5 * (a / b))) / a))
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a)) <= -0.035)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(3.0 * a));
	else
		tmp = Float64(1.0 / Float64(a * Float64(Float64(Float64(-2.0 * Float64(b / c)) + Float64(1.5 * Float64(a / b))) / a)));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -0.035)
		tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (3.0 * a);
	else
		tmp = 1.0 / (a * (((-2.0 * (b / c)) + (1.5 * (a / b))) / a));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], -0.035], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(a * N[(N[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -0.035:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}\\


\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 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < -0.035000000000000003

    1. Initial program 79.4%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg79.4%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing

    if -0.035000000000000003 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

    1. Initial program 45.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{c \cdot \left(-1.5 \cdot \frac{a}{b} + -1.125 \cdot \frac{{a}^{2} \cdot c}{{b}^{3}}\right)}}{3 \cdot a} \]
    6. Step-by-step derivation
      1. clear-num88.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 3}{c \cdot \mathsf{fma}\left(-1.125, {a}^{2} \cdot \frac{c}{{b}^{3}}, -1.5 \cdot \frac{a}{b}\right)}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. unpow-188.3%

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

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

      \[\leadsto \color{blue}{\frac{1}{a \cdot \frac{3}{c \cdot \mathsf{fma}\left(-1.125, {a}^{2} \cdot \frac{c}{{b}^{3}}, -1.5 \cdot \frac{a}{b}\right)}}} \]
    10. Taylor expanded in a around 0 89.0%

      \[\leadsto \frac{1}{a \cdot \color{blue}{\frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a} \leq -0.035:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a \cdot \frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 82.5% accurate, 6.8× speedup?

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

\\
\frac{1}{a \cdot \frac{-2 \cdot \frac{b}{a} + \frac{c}{b} \cdot 1.5}{c}}
\end{array}
Derivation
  1. Initial program 54.2%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{c \cdot \left(-1.5 \cdot \frac{a}{b} + -1.125 \cdot \frac{{a}^{2} \cdot c}{{b}^{3}}\right)}}} \]
    2. inv-pow81.5%

      \[\leadsto \color{blue}{{\left(\frac{3 \cdot a}{c \cdot \left(-1.5 \cdot \frac{a}{b} + -1.125 \cdot \frac{{a}^{2} \cdot c}{{b}^{3}}\right)}\right)}^{-1}} \]
    3. *-commutative81.5%

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

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

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

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

    \[\leadsto \color{blue}{{\left(\frac{a \cdot 3}{c \cdot \mathsf{fma}\left(-1.125, {a}^{2} \cdot \frac{c}{{b}^{3}}, -1.5 \cdot \frac{a}{b}\right)}\right)}^{-1}} \]
  8. Step-by-step derivation
    1. unpow-181.5%

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

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

    \[\leadsto \color{blue}{\frac{1}{a \cdot \frac{3}{c \cdot \mathsf{fma}\left(-1.125, {a}^{2} \cdot \frac{c}{{b}^{3}}, -1.5 \cdot \frac{a}{b}\right)}}} \]
  10. Taylor expanded in c around 0 82.2%

    \[\leadsto \frac{1}{a \cdot \color{blue}{\frac{-2 \cdot \frac{b}{a} + 1.5 \cdot \frac{c}{b}}{c}}} \]
  11. Final simplification82.2%

    \[\leadsto \frac{1}{a \cdot \frac{-2 \cdot \frac{b}{a} + \frac{c}{b} \cdot 1.5}{c}} \]
  12. Add Preprocessing

Alternative 12: 82.5% accurate, 6.8× speedup?

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

\\
\frac{1}{a \cdot \frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}
\end{array}
Derivation
  1. Initial program 54.2%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{c \cdot \left(-1.5 \cdot \frac{a}{b} + -1.125 \cdot \frac{{a}^{2} \cdot c}{{b}^{3}}\right)}}} \]
    2. inv-pow81.5%

      \[\leadsto \color{blue}{{\left(\frac{3 \cdot a}{c \cdot \left(-1.5 \cdot \frac{a}{b} + -1.125 \cdot \frac{{a}^{2} \cdot c}{{b}^{3}}\right)}\right)}^{-1}} \]
    3. *-commutative81.5%

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

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

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

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

    \[\leadsto \color{blue}{{\left(\frac{a \cdot 3}{c \cdot \mathsf{fma}\left(-1.125, {a}^{2} \cdot \frac{c}{{b}^{3}}, -1.5 \cdot \frac{a}{b}\right)}\right)}^{-1}} \]
  8. Step-by-step derivation
    1. unpow-181.5%

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

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

    \[\leadsto \color{blue}{\frac{1}{a \cdot \frac{3}{c \cdot \mathsf{fma}\left(-1.125, {a}^{2} \cdot \frac{c}{{b}^{3}}, -1.5 \cdot \frac{a}{b}\right)}}} \]
  10. Taylor expanded in a around 0 82.3%

    \[\leadsto \frac{1}{a \cdot \color{blue}{\frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}}} \]
  11. Final simplification82.3%

    \[\leadsto \frac{1}{a \cdot \frac{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}{a}} \]
  12. Add Preprocessing

Alternative 13: 64.7% accurate, 23.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 3.2% accurate, 38.7× speedup?

\[\begin{array}{l} \\ \frac{0}{a} \end{array} \]
(FPCore (a b c) :precision binary64 (/ 0.0 a))
double code(double a, double b, double c) {
	return 0.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 = 0.0d0 / a
end function
public static double code(double a, double b, double c) {
	return 0.0 / a;
}
def code(a, b, c):
	return 0.0 / a
function code(a, b, c)
	return Float64(0.0 / a)
end
function tmp = code(a, b, c)
	tmp = 0.0 / a;
end
code[a_, b_, c_] := N[(0.0 / a), $MachinePrecision]
\begin{array}{l}

\\
\frac{0}{a}
\end{array}
Derivation
  1. Initial program 54.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{0.16666666666666666 \cdot \frac{-1 \cdot \left(\sqrt{a \cdot c} \cdot \sqrt{3}\right) + \sqrt{a \cdot c} \cdot \sqrt{3}}{a}} \]
  10. Step-by-step derivation
    1. associate-*r/3.2%

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

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

      \[\leadsto \frac{0.16666666666666666 \cdot \left(\color{blue}{0} \cdot \left(\sqrt{a \cdot c} \cdot \sqrt{3}\right)\right)}{a} \]
    4. mul0-lft3.2%

      \[\leadsto \frac{0.16666666666666666 \cdot \color{blue}{0}}{a} \]
    5. metadata-eval3.2%

      \[\leadsto \frac{\color{blue}{0}}{a} \]
  11. Simplified3.2%

    \[\leadsto \color{blue}{\frac{0}{a}} \]
  12. Final simplification3.2%

    \[\leadsto \frac{0}{a} \]
  13. Add Preprocessing

Reproduce

?
herbie shell --seed 2024071 
(FPCore (a b c)
  :name "Cubic critical, narrow range"
  :precision binary64
  :pre (and (and (and (< 1.0536712127723509e-8 a) (< a 94906265.62425156)) (and (< 1.0536712127723509e-8 b) (< b 94906265.62425156))) (and (< 1.0536712127723509e-8 c) (< c 94906265.62425156)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))