Cubic critical, narrow range

Percentage Accurate: 55.3% → 92.2%
Time: 23.9s
Alternatives: 10
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 10 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.3% 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.2% accurate, 0.1× speedup?

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

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

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

    1. Initial program 85.8%

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

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

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

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

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

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

        \[\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} \]
      3. associate-*r*86.2%

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^{3} + {\left(\left(b + \sqrt{c \cdot \left(a \cdot 3\right)}\right) \cdot \left(b - \sqrt{c \cdot \left(a \cdot 3\right)}\right)\right)}^{1.5}}{{\left(-b\right)}^{2} + \left(\left(b + \sqrt{c \cdot \left(a \cdot 3\right)}\right) \cdot \left(b - \sqrt{c \cdot \left(a \cdot 3\right)}\right) - \left(-b\right) \cdot \sqrt{\left(b + \sqrt{c \cdot \left(a \cdot 3\right)}\right) \cdot \left(b - \sqrt{c \cdot \left(a \cdot 3\right)}\right)}\right)}}}{3 \cdot a} \]
    9. Step-by-step derivation
      1. cancel-sign-sub86.7%

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

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

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

    1. Initial program 46.8%

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

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

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

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

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

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

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

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

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \color{blue}{\frac{\left(-0.16666666666666666 \cdot {\left(a \cdot c\right)}^{4}\right) \cdot 6.328125}{a \cdot {b}^{7}}}\right)\right) \]
    9. Step-by-step derivation
      1. associate-/l*94.9%

        \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \color{blue}{\left(-0.16666666666666666 \cdot {\left(a \cdot c\right)}^{4}\right) \cdot \frac{6.328125}{a \cdot {b}^{7}}}\right)\right) \]
      2. *-commutative94.9%

        \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \color{blue}{\left({\left(a \cdot c\right)}^{4} \cdot -0.16666666666666666\right)} \cdot \frac{6.328125}{a \cdot {b}^{7}}\right)\right) \]
    10. Applied egg-rr94.9%

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \color{blue}{\left({\left(a \cdot c\right)}^{4} \cdot -0.16666666666666666\right) \cdot \frac{6.328125}{a \cdot {b}^{7}}}\right)\right) \]
    11. Step-by-step derivation
      1. associate-*l*94.9%

        \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \color{blue}{{\left(a \cdot c\right)}^{4} \cdot \left(-0.16666666666666666 \cdot \frac{6.328125}{a \cdot {b}^{7}}\right)}\right)\right) \]
      2. associate-*r/94.9%

        \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + {\left(a \cdot c\right)}^{4} \cdot \color{blue}{\frac{-0.16666666666666666 \cdot 6.328125}{a \cdot {b}^{7}}}\right)\right) \]
      3. metadata-eval94.9%

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

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

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

Alternative 2: 92.1% accurate, 0.1× speedup?

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

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

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

    1. Initial program 85.8%

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

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

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

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

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

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

        \[\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} \]
      3. associate-*r*86.2%

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.8%

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

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

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

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

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

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

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

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

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \color{blue}{\frac{\left(-0.16666666666666666 \cdot {\left(a \cdot c\right)}^{4}\right) \cdot 6.328125}{a \cdot {b}^{7}}}\right)\right) \]
    9. Step-by-step derivation
      1. associate-/l*94.9%

        \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \color{blue}{\left(-0.16666666666666666 \cdot {\left(a \cdot c\right)}^{4}\right) \cdot \frac{6.328125}{a \cdot {b}^{7}}}\right)\right) \]
      2. *-commutative94.9%

        \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \color{blue}{\left({\left(a \cdot c\right)}^{4} \cdot -0.16666666666666666\right)} \cdot \frac{6.328125}{a \cdot {b}^{7}}\right)\right) \]
    10. Applied egg-rr94.9%

      \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \color{blue}{\left({\left(a \cdot c\right)}^{4} \cdot -0.16666666666666666\right) \cdot \frac{6.328125}{a \cdot {b}^{7}}}\right)\right) \]
    11. Step-by-step derivation
      1. associate-*l*94.9%

        \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \color{blue}{{\left(a \cdot c\right)}^{4} \cdot \left(-0.16666666666666666 \cdot \frac{6.328125}{a \cdot {b}^{7}}\right)}\right)\right) \]
      2. associate-*r/94.9%

        \[\leadsto -0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + \left(-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + {\left(a \cdot c\right)}^{4} \cdot \color{blue}{\frac{-0.16666666666666666 \cdot 6.328125}{a \cdot {b}^{7}}}\right)\right) \]
      3. metadata-eval94.9%

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

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

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

Alternative 3: 90.1% accurate, 0.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + \frac{\left(c \cdot {a}^{2}\right) \cdot 1.125}{{b}^{3}}\right)}\\


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

    1. Initial program 85.8%

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

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

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

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

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

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

        \[\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} \]
      3. associate-*r*86.2%

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{-0.375 \cdot \left({a}^{2} \cdot c\right) + 0.75 \cdot \left({a}^{2} \cdot c\right)}{{b}^{3}}\right)}} \]
    11. Taylor expanded in a around 0 93.0%

      \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + \color{blue}{3 \cdot \frac{{a}^{2} \cdot \left(-0.375 \cdot c + 0.75 \cdot c\right)}{{b}^{3}}}\right)} \]
    12. Step-by-step derivation
      1. *-commutative93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{\color{blue}{\left(-0.375 \cdot c + 0.75 \cdot c\right) \cdot {a}^{2}}}{{b}^{3}}\right)} \]
      2. distribute-rgt-out93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{\color{blue}{\left(c \cdot \left(-0.375 + 0.75\right)\right)} \cdot {a}^{2}}{{b}^{3}}\right)} \]
      3. metadata-eval93.0%

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

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

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{c \cdot \color{blue}{\left({a}^{2} \cdot 0.375\right)}}{{b}^{3}}\right)} \]
      6. metadata-eval93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{c \cdot \left({a}^{2} \cdot \color{blue}{\left(-0.375 + 0.75\right)}\right)}{{b}^{3}}\right)} \]
      7. distribute-rgt-out93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{c \cdot \color{blue}{\left(-0.375 \cdot {a}^{2} + 0.75 \cdot {a}^{2}\right)}}{{b}^{3}}\right)} \]
      8. distribute-rgt-out93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{c \cdot \color{blue}{\left({a}^{2} \cdot \left(-0.375 + 0.75\right)\right)}}{{b}^{3}}\right)} \]
      9. metadata-eval93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{c \cdot \left({a}^{2} \cdot \color{blue}{0.375}\right)}{{b}^{3}}\right)} \]
      10. associate-*l*93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{\color{blue}{\left(c \cdot {a}^{2}\right) \cdot 0.375}}{{b}^{3}}\right)} \]
      11. associate-*r/93.0%

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

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + \frac{\color{blue}{\left(\left(c \cdot {a}^{2}\right) \cdot 0.375\right) \cdot 3}}{{b}^{3}}\right)} \]
      13. associate-*l*93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + \frac{\color{blue}{\left(c \cdot {a}^{2}\right) \cdot \left(0.375 \cdot 3\right)}}{{b}^{3}}\right)} \]
      14. metadata-eval93.0%

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

      \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + \color{blue}{\frac{\left(c \cdot {a}^{2}\right) \cdot 1.125}{{b}^{3}}}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.0%

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

Alternative 4: 90.1% 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 -2.2:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + \frac{\left(c \cdot {a}^{2}\right) \cdot 1.125}{{b}^{3}}\right)}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a)) -2.2)
   (/ (- (sqrt (fma b b (* a (* c -3.0)))) b) (* 3.0 a))
   (/
    1.0
    (+
     (* -2.0 (/ b c))
     (+ (* 1.5 (/ a b)) (/ (* (* c (pow a 2.0)) 1.125) (pow b 3.0)))))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)) <= -2.2) {
		tmp = (sqrt(fma(b, b, (a * (c * -3.0)))) - b) / (3.0 * a);
	} else {
		tmp = 1.0 / ((-2.0 * (b / c)) + ((1.5 * (a / b)) + (((c * pow(a, 2.0)) * 1.125) / pow(b, 3.0))));
	}
	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)) <= -2.2)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(c * -3.0)))) - b) / Float64(3.0 * a));
	else
		tmp = Float64(1.0 / Float64(Float64(-2.0 * Float64(b / c)) + Float64(Float64(1.5 * Float64(a / b)) + Float64(Float64(Float64(c * (a ^ 2.0)) * 1.125) / (b ^ 3.0)))));
	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], -2.2], 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[(N[(-2.0 * N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(N[(1.5 * N[(a / b), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(c * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] * 1.125), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $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 -2.2:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{3 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + \frac{\left(c \cdot {a}^{2}\right) \cdot 1.125}{{b}^{3}}\right)}\\


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

    1. Initial program 85.8%

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

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

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

      \[\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 -2.2000000000000002 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a))

    1. Initial program 46.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{-0.375 \cdot \left({a}^{2} \cdot c\right) + 0.75 \cdot \left({a}^{2} \cdot c\right)}{{b}^{3}}\right)}} \]
    11. Taylor expanded in a around 0 93.0%

      \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + \color{blue}{3 \cdot \frac{{a}^{2} \cdot \left(-0.375 \cdot c + 0.75 \cdot c\right)}{{b}^{3}}}\right)} \]
    12. Step-by-step derivation
      1. *-commutative93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{\color{blue}{\left(-0.375 \cdot c + 0.75 \cdot c\right) \cdot {a}^{2}}}{{b}^{3}}\right)} \]
      2. distribute-rgt-out93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{\color{blue}{\left(c \cdot \left(-0.375 + 0.75\right)\right)} \cdot {a}^{2}}{{b}^{3}}\right)} \]
      3. metadata-eval93.0%

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

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

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{c \cdot \color{blue}{\left({a}^{2} \cdot 0.375\right)}}{{b}^{3}}\right)} \]
      6. metadata-eval93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{c \cdot \left({a}^{2} \cdot \color{blue}{\left(-0.375 + 0.75\right)}\right)}{{b}^{3}}\right)} \]
      7. distribute-rgt-out93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{c \cdot \color{blue}{\left(-0.375 \cdot {a}^{2} + 0.75 \cdot {a}^{2}\right)}}{{b}^{3}}\right)} \]
      8. distribute-rgt-out93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{c \cdot \color{blue}{\left({a}^{2} \cdot \left(-0.375 + 0.75\right)\right)}}{{b}^{3}}\right)} \]
      9. metadata-eval93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{c \cdot \left({a}^{2} \cdot \color{blue}{0.375}\right)}{{b}^{3}}\right)} \]
      10. associate-*l*93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + 3 \cdot \frac{\color{blue}{\left(c \cdot {a}^{2}\right) \cdot 0.375}}{{b}^{3}}\right)} \]
      11. associate-*r/93.0%

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

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + \frac{\color{blue}{\left(\left(c \cdot {a}^{2}\right) \cdot 0.375\right) \cdot 3}}{{b}^{3}}\right)} \]
      13. associate-*l*93.0%

        \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + \frac{\color{blue}{\left(c \cdot {a}^{2}\right) \cdot \left(0.375 \cdot 3\right)}}{{b}^{3}}\right)} \]
      14. metadata-eval93.0%

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

      \[\leadsto \frac{1}{-2 \cdot \frac{b}{c} + \left(1.5 \cdot \frac{a}{b} + \color{blue}{\frac{\left(c \cdot {a}^{2}\right) \cdot 1.125}{{b}^{3}}}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.9%

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

Alternative 5: 85.5% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 30

    1. Initial program 81.3%

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

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

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

      \[\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 30 < b

    1. Initial program 43.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. sqr-neg43.4%

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified43.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 b around inf 93.9%

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

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

        \[\leadsto \color{blue}{{\left(\frac{3 \cdot a}{-1.6875 \cdot \frac{{a}^{3} \cdot {c}^{3}}{{b}^{5}} + \left(-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{{a}^{2} \cdot {c}^{2}}{{b}^{3}}\right)}\right)}^{-1}} \]
    7. Applied egg-rr93.9%

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

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

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

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

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

Alternative 6: 85.4% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 30

    1. Initial program 81.3%

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

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

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

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

      \[\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 30 < b

    1. Initial program 43.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. sqr-neg43.4%

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified43.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 b around inf 93.9%

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

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

        \[\leadsto \color{blue}{{\left(\frac{3 \cdot a}{-1.6875 \cdot \frac{{a}^{3} \cdot {c}^{3}}{{b}^{5}} + \left(-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{{a}^{2} \cdot {c}^{2}}{{b}^{3}}\right)}\right)}^{-1}} \]
    7. Applied egg-rr93.9%

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

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

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

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

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

Alternative 7: 82.2% accurate, 8.9× speedup?

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

\\
\frac{1}{-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}}
\end{array}
Derivation
  1. Initial program 52.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. sqr-neg52.6%

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  3. Simplified52.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. Taylor expanded in b around inf 88.1%

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

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

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

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

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

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

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

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

Alternative 8: 64.4% accurate, 23.2× speedup?

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

\\
c \cdot \frac{-0.5}{b}
\end{array}
Derivation
  1. Initial program 52.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. sqr-neg52.6%

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  3. Simplified52.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. Taylor expanded in b around inf 88.1%

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

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

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

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

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

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

    \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c}}} \]
  11. Step-by-step derivation
    1. *-un-lft-identity66.4%

      \[\leadsto \color{blue}{1 \cdot \frac{1}{-2 \cdot \frac{b}{c}}} \]
    2. associate-/r*66.4%

      \[\leadsto 1 \cdot \color{blue}{\frac{\frac{1}{-2}}{\frac{b}{c}}} \]
    3. metadata-eval66.4%

      \[\leadsto 1 \cdot \frac{\color{blue}{-0.5}}{\frac{b}{c}} \]
  12. Applied egg-rr66.4%

    \[\leadsto \color{blue}{1 \cdot \frac{-0.5}{\frac{b}{c}}} \]
  13. Step-by-step derivation
    1. *-lft-identity66.4%

      \[\leadsto \color{blue}{\frac{-0.5}{\frac{b}{c}}} \]
    2. associate-/r/66.4%

      \[\leadsto \color{blue}{\frac{-0.5}{b} \cdot c} \]
  14. Simplified66.4%

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

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

Alternative 9: 64.5% accurate, 23.2× speedup?

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

\\
\frac{c \cdot -0.5}{b}
\end{array}
Derivation
  1. Initial program 52.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. sqr-neg52.6%

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  3. Simplified52.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. Taylor expanded in b around inf 66.5%

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
  6. Step-by-step derivation
    1. *-commutative66.5%

      \[\leadsto \color{blue}{\frac{c}{b} \cdot -0.5} \]
    2. associate-*l/66.5%

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

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

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

Alternative 10: 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 52.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. sqr-neg52.6%

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  3. Simplified52.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-sqrt52.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-squares52.8%

      \[\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} \]
    3. associate-*r*52.8%

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

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

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

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

    \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(b + \sqrt{c \cdot \left(3 \cdot a\right)}\right) \cdot \left(b - \sqrt{c \cdot \left(3 \cdot a\right)}\right)}}}{3 \cdot a} \]
  7. 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}} \]
  8. 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} \]
  9. Simplified3.2%

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

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

Reproduce

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