Cubic critical, narrow range

Percentage Accurate: 55.9% → 91.9%
Time: 14.1s
Alternatives: 8
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 8 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.9% 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: 91.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 0.05:\\ \;\;\;\;\frac{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)\right)}^{0.5} - b}{a \cdot 3}\\ \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}} + \frac{{a}^{3}}{\frac{\frac{{b}^{7}}{{c}^{4}}}{-1.0546875}}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 0.05)
   (/ (- (pow (fma b b (* a (* c -3.0))) 0.5) b) (* a 3.0))
   (+
    (* -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 3.0) (/ (/ (pow b 7.0) (pow c 4.0)) -1.0546875)))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 0.05) {
		tmp = (pow(fma(b, b, (a * (c * -3.0))), 0.5) - b) / (a * 3.0);
	} 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, 3.0) / ((pow(b, 7.0) / pow(c, 4.0)) / -1.0546875))));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= 0.05)
		tmp = Float64(Float64((fma(b, b, Float64(a * Float64(c * -3.0))) ^ 0.5) - b) / Float64(a * 3.0));
	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((a ^ 3.0) / Float64(Float64((b ^ 7.0) / (c ^ 4.0)) / -1.0546875)))));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 0.05], N[(N[(N[Power[N[(b * b + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $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[a, 3.0], $MachinePrecision] / N[(N[(N[Power[b, 7.0], $MachinePrecision] / N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision] / -1.0546875), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\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}} + \frac{{a}^{3}}{\frac{\frac{{b}^{7}}{{c}^{4}}}{-1.0546875}}\right)\right)\\


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

    1. Initial program 89.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. Simplified89.3%

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

          \[\leadsto \frac{\color{blue}{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)\right)}^{0.5}} - b}{3 \cdot a} \]
      3. Applied egg-rr89.3%

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

      if 0.050000000000000003 < b

      1. Initial program 52.4%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
      2. Taylor expanded in b around inf 93.0%

        \[\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)} \]
      3. Taylor expanded in a around 0 93.0%

        \[\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}} + -0.16666666666666666 \cdot \color{blue}{\frac{{a}^{3} \cdot \left(1.265625 \cdot {c}^{4} + 5.0625 \cdot {c}^{4}\right)}{{b}^{7}}}\right)\right) \]
      4. Step-by-step derivation
        1. associate-/l*93.0%

          \[\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}} + -0.16666666666666666 \cdot \color{blue}{\frac{{a}^{3}}{\frac{{b}^{7}}{1.265625 \cdot {c}^{4} + 5.0625 \cdot {c}^{4}}}}\right)\right) \]
        2. distribute-rgt-out93.0%

          \[\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}} + -0.16666666666666666 \cdot \frac{{a}^{3}}{\frac{{b}^{7}}{\color{blue}{{c}^{4} \cdot \left(1.265625 + 5.0625\right)}}}\right)\right) \]
        3. metadata-eval93.0%

          \[\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}} + -0.16666666666666666 \cdot \frac{{a}^{3}}{\frac{{b}^{7}}{{c}^{4} \cdot \color{blue}{6.328125}}}\right)\right) \]
      5. Simplified93.0%

        \[\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}} + -0.16666666666666666 \cdot \color{blue}{\frac{{a}^{3}}{\frac{{b}^{7}}{{c}^{4} \cdot 6.328125}}}\right)\right) \]
      6. Step-by-step derivation
        1. associate-*r/93.0%

          \[\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 {a}^{3}}{\frac{{b}^{7}}{{c}^{4} \cdot 6.328125}}}\right)\right) \]
        2. div-inv93.0%

          \[\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}} + \frac{-0.16666666666666666 \cdot {a}^{3}}{\color{blue}{{b}^{7} \cdot \frac{1}{{c}^{4} \cdot 6.328125}}}\right)\right) \]
        3. *-commutative93.0%

          \[\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}} + \frac{-0.16666666666666666 \cdot {a}^{3}}{{b}^{7} \cdot \frac{1}{\color{blue}{6.328125 \cdot {c}^{4}}}}\right)\right) \]
        4. associate-/r*93.0%

          \[\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}} + \frac{-0.16666666666666666 \cdot {a}^{3}}{{b}^{7} \cdot \color{blue}{\frac{\frac{1}{6.328125}}{{c}^{4}}}}\right)\right) \]
        5. metadata-eval93.0%

          \[\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}} + \frac{-0.16666666666666666 \cdot {a}^{3}}{{b}^{7} \cdot \frac{\color{blue}{0.1580246913580247}}{{c}^{4}}}\right)\right) \]
      7. Applied egg-rr93.0%

        \[\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 {a}^{3}}{{b}^{7} \cdot \frac{0.1580246913580247}{{c}^{4}}}}\right)\right) \]
      8. Step-by-step derivation
        1. *-commutative93.0%

          \[\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}} + \frac{\color{blue}{{a}^{3} \cdot -0.16666666666666666}}{{b}^{7} \cdot \frac{0.1580246913580247}{{c}^{4}}}\right)\right) \]
        2. associate-/l*93.0%

          \[\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{{a}^{3}}{\frac{{b}^{7} \cdot \frac{0.1580246913580247}{{c}^{4}}}{-0.16666666666666666}}}\right)\right) \]
        3. associate-*r/93.0%

          \[\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}} + \frac{{a}^{3}}{\frac{\color{blue}{\frac{{b}^{7} \cdot 0.1580246913580247}{{c}^{4}}}}{-0.16666666666666666}}\right)\right) \]
        4. associate-*l/93.0%

          \[\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}} + \frac{{a}^{3}}{\frac{\color{blue}{\frac{{b}^{7}}{{c}^{4}} \cdot 0.1580246913580247}}{-0.16666666666666666}}\right)\right) \]
        5. associate-/l*93.0%

          \[\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}} + \frac{{a}^{3}}{\color{blue}{\frac{\frac{{b}^{7}}{{c}^{4}}}{\frac{-0.16666666666666666}{0.1580246913580247}}}}\right)\right) \]
        6. metadata-eval93.0%

          \[\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}} + \frac{{a}^{3}}{\frac{\frac{{b}^{7}}{{c}^{4}}}{\color{blue}{-1.0546875}}}\right)\right) \]
      9. Simplified93.0%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.05:\\ \;\;\;\;\frac{{\left(\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)\right)}^{0.5} - b}{a \cdot 3}\\ \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}} + \frac{{a}^{3}}{\frac{\frac{{b}^{7}}{{c}^{4}}}{-1.0546875}}\right)\right)\\ \end{array} \]

    Alternative 2: 88.1% accurate, 0.2× speedup?

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

      1. Initial program 83.2%

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

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

      1. Initial program 46.2%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
      2. Taylor expanded in b around inf 93.3%

        \[\leadsto \color{blue}{-0.5625 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right)} \]
      3. Step-by-step derivation
        1. add-sqr-sqrt93.3%

          \[\leadsto -0.5625 \cdot \frac{\color{blue}{\sqrt{{a}^{2} \cdot {c}^{3}} \cdot \sqrt{{a}^{2} \cdot {c}^{3}}}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
        2. sqr-pow93.3%

          \[\leadsto -0.5625 \cdot \frac{\sqrt{{a}^{2} \cdot {c}^{3}} \cdot \sqrt{{a}^{2} \cdot {c}^{3}}}{\color{blue}{{b}^{\left(\frac{5}{2}\right)} \cdot {b}^{\left(\frac{5}{2}\right)}}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
        3. times-frac93.3%

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

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

          \[\leadsto -0.5625 \cdot \left(\frac{\sqrt{\color{blue}{a \cdot a}} \cdot \sqrt{{c}^{3}}}{{b}^{\left(\frac{5}{2}\right)}} \cdot \frac{\sqrt{{a}^{2} \cdot {c}^{3}}}{{b}^{\left(\frac{5}{2}\right)}}\right) + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
        6. sqrt-prod93.3%

          \[\leadsto -0.5625 \cdot \left(\frac{\color{blue}{\left(\sqrt{a} \cdot \sqrt{a}\right)} \cdot \sqrt{{c}^{3}}}{{b}^{\left(\frac{5}{2}\right)}} \cdot \frac{\sqrt{{a}^{2} \cdot {c}^{3}}}{{b}^{\left(\frac{5}{2}\right)}}\right) + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
        7. add-sqr-sqrt93.3%

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

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

          \[\leadsto -0.5625 \cdot \left(\frac{a \cdot {c}^{\color{blue}{1.5}}}{{b}^{\left(\frac{5}{2}\right)}} \cdot \frac{\sqrt{{a}^{2} \cdot {c}^{3}}}{{b}^{\left(\frac{5}{2}\right)}}\right) + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
        10. metadata-eval93.3%

          \[\leadsto -0.5625 \cdot \left(\frac{a \cdot {c}^{1.5}}{{b}^{\color{blue}{2.5}}} \cdot \frac{\sqrt{{a}^{2} \cdot {c}^{3}}}{{b}^{\left(\frac{5}{2}\right)}}\right) + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
      4. Applied egg-rr93.3%

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

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

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

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

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

          \[\leadsto -0.5625 \cdot \frac{\left(a \cdot {c}^{1.5}\right) \cdot \left(a \cdot {c}^{1.5}\right)}{{b}^{\left(\frac{5}{2}\right)} \cdot {b}^{\color{blue}{\left(\frac{5}{2}\right)}}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
        6. sqr-pow93.3%

          \[\leadsto -0.5625 \cdot \frac{\left(a \cdot {c}^{1.5}\right) \cdot \left(a \cdot {c}^{1.5}\right)}{\color{blue}{{b}^{5}}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
        7. associate-*l*93.3%

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

          \[\leadsto -0.5625 \cdot \frac{a \cdot \left({c}^{1.5} \cdot \color{blue}{\left({c}^{1.5} \cdot a\right)}\right)}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
        9. associate-*l*93.3%

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

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

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

          \[\leadsto -0.5625 \cdot \frac{a \cdot \left(\color{blue}{{c}^{3}} \cdot a\right)}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right) \]
      6. Simplified93.3%

        \[\leadsto -0.5625 \cdot \color{blue}{\frac{a \cdot \left({c}^{3} \cdot a\right)}{{b}^{5}}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {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 - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.004:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;-0.5625 \cdot \frac{a \cdot \left(a \cdot {c}^{3}\right)}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}\right)\\ \end{array} \]

    Alternative 3: 84.3% accurate, 0.4× speedup?

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

      1. Initial program 80.8%

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

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

      1. Initial program 41.0%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
      2. Taylor expanded in b around inf 91.7%

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

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

    Alternative 4: 84.1% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{if}\;t_0 \leq -0.00015:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{{\left(c \cdot \frac{a}{b}\right)}^{2}}{b}}{a \cdot 3}\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (let* ((t_0 (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))))
       (if (<= t_0 -0.00015)
         t_0
         (/
          (+ (* -1.5 (/ (* a c) b)) (* -1.125 (/ (pow (* c (/ a b)) 2.0) b)))
          (* a 3.0)))))
    double code(double a, double b, double c) {
    	double t_0 = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
    	double tmp;
    	if (t_0 <= -0.00015) {
    		tmp = t_0;
    	} else {
    		tmp = ((-1.5 * ((a * c) / b)) + (-1.125 * (pow((c * (a / b)), 2.0) / b))) / (a * 3.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(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
        if (t_0 <= (-0.00015d0)) then
            tmp = t_0
        else
            tmp = (((-1.5d0) * ((a * c) / b)) + ((-1.125d0) * (((c * (a / b)) ** 2.0d0) / b))) / (a * 3.0d0)
        end if
        code = tmp
    end function
    
    public static double code(double a, double b, double c) {
    	double t_0 = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
    	double tmp;
    	if (t_0 <= -0.00015) {
    		tmp = t_0;
    	} else {
    		tmp = ((-1.5 * ((a * c) / b)) + (-1.125 * (Math.pow((c * (a / b)), 2.0) / b))) / (a * 3.0);
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	t_0 = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)
    	tmp = 0
    	if t_0 <= -0.00015:
    		tmp = t_0
    	else:
    		tmp = ((-1.5 * ((a * c) / b)) + (-1.125 * (math.pow((c * (a / b)), 2.0) / b))) / (a * 3.0)
    	return tmp
    
    function code(a, b, c)
    	t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0))
    	tmp = 0.0
    	if (t_0 <= -0.00015)
    		tmp = t_0;
    	else
    		tmp = Float64(Float64(Float64(-1.5 * Float64(Float64(a * c) / b)) + Float64(-1.125 * Float64((Float64(c * Float64(a / b)) ^ 2.0) / b))) / Float64(a * 3.0));
    	end
    	return tmp
    end
    
    function tmp_2 = code(a, b, c)
    	t_0 = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
    	tmp = 0.0;
    	if (t_0 <= -0.00015)
    		tmp = t_0;
    	else
    		tmp = ((-1.5 * ((a * c) / b)) + (-1.125 * (((c * (a / b)) ^ 2.0) / b))) / (a * 3.0);
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.00015], t$95$0, N[(N[(N[(-1.5 * N[(N[(a * c), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision] + N[(-1.125 * N[(N[Power[N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
    \mathbf{if}\;t_0 \leq -0.00015:\\
    \;\;\;\;t_0\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{{\left(c \cdot \frac{a}{b}\right)}^{2}}{b}}{a \cdot 3}\\
    
    
    \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)) < -1.49999999999999987e-4

      1. Initial program 80.8%

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

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

      1. Initial program 41.0%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
      2. Taylor expanded in b around inf 91.2%

        \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{{a}^{2} \cdot {c}^{2}}{{b}^{3}}}}{3 \cdot a} \]
      3. Step-by-step derivation
        1. add-log-exp83.1%

          \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \color{blue}{\log \left(e^{\frac{{a}^{2} \cdot {c}^{2}}{{b}^{3}}}\right)}}{3 \cdot a} \]
        2. pow-prod-down83.1%

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

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

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

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

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

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

          \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{\color{blue}{\frac{a \cdot c}{b} \cdot \frac{a \cdot c}{b}}}{b}}{3 \cdot a} \]
        6. associate-*l/91.2%

          \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{\color{blue}{\left(\frac{a}{b} \cdot c\right)} \cdot \frac{a \cdot c}{b}}{b}}{3 \cdot a} \]
        7. associate-*l/91.2%

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

          \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{\color{blue}{{\left(\frac{a}{b} \cdot c\right)}^{1}} \cdot \left(\frac{a}{b} \cdot c\right)}{b}}{3 \cdot a} \]
        9. associate-*l/91.2%

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.00015:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{{\left(c \cdot \frac{a}{b}\right)}^{2}}{b}}{a \cdot 3}\\ \end{array} \]

    Alternative 5: 76.3% accurate, 0.5× speedup?

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

      1. Initial program 77.5%

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

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

      1. Initial program 34.8%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
      2. Taylor expanded in b around inf 81.5%

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

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

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

        \[\leadsto \color{blue}{\frac{c \cdot -0.5}{b}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification79.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -3 \cdot 10^{-6}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

    Alternative 6: 63.9% 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 57.0%

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{-0.5}{b} \cdot c} \]
      7. Applied egg-rr62.7%

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

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

      Alternative 7: 63.9% accurate, 23.2× speedup?

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{-0.5}{\frac{b}{c}}} \]
        6. Final simplification62.7%

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

        Alternative 8: 64.0% 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 57.0%

          \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
        2. Taylor expanded in b around inf 62.8%

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

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

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

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

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

        Reproduce

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