Cubic critical

Percentage Accurate: 53.0% → 85.3%
Time: 12.7s
Alternatives: 8
Speedup: 16.4×

Specification

?
\[\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: 53.0% 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: 85.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{+130}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\

\mathbf{elif}\;b \leq 1.2 \cdot 10^{-111}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -4.9999999999999996e130

    1. Initial program 41.9%

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]

    if -4.9999999999999996e130 < b < 1.2e-111

    1. Initial program 80.4%

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

    if 1.2e-111 < b

    1. Initial program 16.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+130}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 1.2 \cdot 10^{-111}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

Alternative 2: 80.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.1 \cdot 10^{-106}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\

\mathbf{elif}\;b \leq 7.5 \cdot 10^{-112}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -3.09999999999999985e-106

    1. Initial program 64.9%

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]

    if -3.09999999999999985e-106 < b < 7.5000000000000002e-112

    1. Initial program 71.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + {\left({\left(\left(-\color{blue}{c \cdot \left(3 \cdot a\right)}\right) + b \cdot b\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{3 \cdot a} \]
      8. distribute-rgt-neg-in71.2%

        \[\leadsto \frac{\left(-b\right) + {\left({\left(\color{blue}{c \cdot \left(-3 \cdot a\right)} + b \cdot b\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{3 \cdot a} \]
      9. distribute-lft-neg-in71.2%

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

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

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

        \[\leadsto \frac{\left(-b\right) + {\left({\left(\color{blue}{a \cdot \left(c \cdot -3\right)} + b \cdot b\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{3 \cdot a} \]
      13. fma-udef71.1%

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

        \[\leadsto \frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(a, c \cdot -3, \color{blue}{{b}^{2}}\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{3 \cdot a} \]
      15. metadata-eval71.1%

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

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

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

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

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

      if 7.5000000000000002e-112 < b

      1. Initial program 16.6%

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

        \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
    6. Recombined 3 regimes into one program.
    7. Final simplification80.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.1 \cdot 10^{-106}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 7.5 \cdot 10^{-112}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

    Alternative 3: 80.2% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -8.2 \cdot 10^{-106}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 1.1 \cdot 10^{-111}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= b -8.2e-106)
       (+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
       (if (<= b 1.1e-111)
         (/ (- (sqrt (* a (* c -3.0))) b) (* a 3.0))
         (* (/ c b) -0.5))))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -8.2e-106) {
    		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
    	} else if (b <= 1.1e-111) {
    		tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0);
    	} else {
    		tmp = (c / b) * -0.5;
    	}
    	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 <= (-8.2d-106)) then
            tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
        else if (b <= 1.1d-111) then
            tmp = (sqrt((a * (c * (-3.0d0)))) - b) / (a * 3.0d0)
        else
            tmp = (c / b) * (-0.5d0)
        end if
        code = tmp
    end function
    
    public static double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -8.2e-106) {
    		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
    	} else if (b <= 1.1e-111) {
    		tmp = (Math.sqrt((a * (c * -3.0))) - b) / (a * 3.0);
    	} else {
    		tmp = (c / b) * -0.5;
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	tmp = 0
    	if b <= -8.2e-106:
    		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b))
    	elif b <= 1.1e-111:
    		tmp = (math.sqrt((a * (c * -3.0))) - b) / (a * 3.0)
    	else:
    		tmp = (c / b) * -0.5
    	return tmp
    
    function code(a, b, c)
    	tmp = 0.0
    	if (b <= -8.2e-106)
    		tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b)));
    	elseif (b <= 1.1e-111)
    		tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / Float64(a * 3.0));
    	else
    		tmp = Float64(Float64(c / b) * -0.5);
    	end
    	return tmp
    end
    
    function tmp_2 = code(a, b, c)
    	tmp = 0.0;
    	if (b <= -8.2e-106)
    		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
    	elseif (b <= 1.1e-111)
    		tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0);
    	else
    		tmp = (c / b) * -0.5;
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := If[LessEqual[b, -8.2e-106], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.1e-111], N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq -8.2 \cdot 10^{-106}:\\
    \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
    
    \mathbf{elif}\;b \leq 1.1 \cdot 10^{-111}:\\
    \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{c}{b} \cdot -0.5\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if b < -8.1999999999999998e-106

      1. Initial program 64.9%

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

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]

      if -8.1999999999999998e-106 < b < 1.1e-111

      1. Initial program 71.7%

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

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

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

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

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

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

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

          \[\leadsto \frac{\left(-b\right) + {\left({\left(\left(-\color{blue}{c \cdot \left(3 \cdot a\right)}\right) + b \cdot b\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{3 \cdot a} \]
        8. distribute-rgt-neg-in71.2%

          \[\leadsto \frac{\left(-b\right) + {\left({\left(\color{blue}{c \cdot \left(-3 \cdot a\right)} + b \cdot b\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{3 \cdot a} \]
        9. distribute-lft-neg-in71.2%

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

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

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

          \[\leadsto \frac{\left(-b\right) + {\left({\left(\color{blue}{a \cdot \left(c \cdot -3\right)} + b \cdot b\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{3 \cdot a} \]
        13. fma-udef71.1%

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

          \[\leadsto \frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(a, c \cdot -3, \color{blue}{{b}^{2}}\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{3 \cdot a} \]
        15. metadata-eval71.1%

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

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

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

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

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

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

      if 1.1e-111 < b

      1. Initial program 16.6%

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -8.2 \cdot 10^{-106}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 1.1 \cdot 10^{-111}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

    Alternative 4: 80.2% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -6.6 \cdot 10^{-106}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-112}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= b -6.6e-106)
       (+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
       (if (<= b 4e-112)
         (/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
         (* (/ c b) -0.5))))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -6.6e-106) {
    		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
    	} else if (b <= 4e-112) {
    		tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
    	} else {
    		tmp = (c / b) * -0.5;
    	}
    	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 <= (-6.6d-106)) then
            tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
        else if (b <= 4d-112) then
            tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
        else
            tmp = (c / b) * (-0.5d0)
        end if
        code = tmp
    end function
    
    public static double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -6.6e-106) {
    		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
    	} else if (b <= 4e-112) {
    		tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
    	} else {
    		tmp = (c / b) * -0.5;
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	tmp = 0
    	if b <= -6.6e-106:
    		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b))
    	elif b <= 4e-112:
    		tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0)
    	else:
    		tmp = (c / b) * -0.5
    	return tmp
    
    function code(a, b, c)
    	tmp = 0.0
    	if (b <= -6.6e-106)
    		tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b)));
    	elseif (b <= 4e-112)
    		tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0));
    	else
    		tmp = Float64(Float64(c / b) * -0.5);
    	end
    	return tmp
    end
    
    function tmp_2 = code(a, b, c)
    	tmp = 0.0;
    	if (b <= -6.6e-106)
    		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
    	elseif (b <= 4e-112)
    		tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
    	else
    		tmp = (c / b) * -0.5;
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := If[LessEqual[b, -6.6e-106], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4e-112], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq -6.6 \cdot 10^{-106}:\\
    \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
    
    \mathbf{elif}\;b \leq 4 \cdot 10^{-112}:\\
    \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{c}{b} \cdot -0.5\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if b < -6.60000000000000031e-106

      1. Initial program 64.9%

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

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]

      if -6.60000000000000031e-106 < b < 3.9999999999999998e-112

      1. Initial program 71.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 3.9999999999999998e-112 < b

      1. Initial program 16.6%

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.6 \cdot 10^{-106}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-112}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

    Alternative 5: 68.0% accurate, 8.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= b -5e-310)
       (+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
       (* (/ c b) -0.5)))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -5e-310) {
    		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
    	} else {
    		tmp = (c / b) * -0.5;
    	}
    	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 <= (-5d-310)) then
            tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
        else
            tmp = (c / b) * (-0.5d0)
        end if
        code = tmp
    end function
    
    public static double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -5e-310) {
    		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
    	} else {
    		tmp = (c / b) * -0.5;
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	tmp = 0
    	if b <= -5e-310:
    		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b))
    	else:
    		tmp = (c / b) * -0.5
    	return tmp
    
    function code(a, b, c)
    	tmp = 0.0
    	if (b <= -5e-310)
    		tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b)));
    	else
    		tmp = Float64(Float64(c / b) * -0.5);
    	end
    	return tmp
    end
    
    function tmp_2 = code(a, b, c)
    	tmp = 0.0;
    	if (b <= -5e-310)
    		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
    	else
    		tmp = (c / b) * -0.5;
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
    \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{c}{b} \cdot -0.5\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if b < -4.999999999999985e-310

      1. Initial program 67.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 71.2%

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]

      if -4.999999999999985e-310 < b

      1. Initial program 30.7%

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

    Alternative 6: 67.8% accurate, 16.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= b -5e-310) (* -0.6666666666666666 (/ b a)) (* (/ c b) -0.5)))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -5e-310) {
    		tmp = -0.6666666666666666 * (b / a);
    	} else {
    		tmp = (c / b) * -0.5;
    	}
    	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 <= (-5d-310)) then
            tmp = (-0.6666666666666666d0) * (b / a)
        else
            tmp = (c / b) * (-0.5d0)
        end if
        code = tmp
    end function
    
    public static double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -5e-310) {
    		tmp = -0.6666666666666666 * (b / a);
    	} else {
    		tmp = (c / b) * -0.5;
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	tmp = 0
    	if b <= -5e-310:
    		tmp = -0.6666666666666666 * (b / a)
    	else:
    		tmp = (c / b) * -0.5
    	return tmp
    
    function code(a, b, c)
    	tmp = 0.0
    	if (b <= -5e-310)
    		tmp = Float64(-0.6666666666666666 * Float64(b / a));
    	else
    		tmp = Float64(Float64(c / b) * -0.5);
    	end
    	return tmp
    end
    
    function tmp_2 = code(a, b, c)
    	tmp = 0.0;
    	if (b <= -5e-310)
    		tmp = -0.6666666666666666 * (b / a);
    	else
    		tmp = (c / b) * -0.5;
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
    \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{c}{b} \cdot -0.5\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if b < -4.999999999999985e-310

      1. Initial program 67.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 70.6%

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
      3. Step-by-step derivation
        1. *-commutative70.6%

          \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      4. Simplified70.6%

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]

      if -4.999999999999985e-310 < b

      1. Initial program 30.7%

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

    Alternative 7: 67.9% accurate, 16.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 8.6 \cdot 10^{-308}:\\ \;\;\;\;\frac{\frac{b}{-1.5}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= b 8.6e-308) (/ (/ b -1.5) a) (* (/ c b) -0.5)))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= 8.6e-308) {
    		tmp = (b / -1.5) / a;
    	} else {
    		tmp = (c / b) * -0.5;
    	}
    	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 <= 8.6d-308) then
            tmp = (b / (-1.5d0)) / a
        else
            tmp = (c / b) * (-0.5d0)
        end if
        code = tmp
    end function
    
    public static double code(double a, double b, double c) {
    	double tmp;
    	if (b <= 8.6e-308) {
    		tmp = (b / -1.5) / a;
    	} else {
    		tmp = (c / b) * -0.5;
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	tmp = 0
    	if b <= 8.6e-308:
    		tmp = (b / -1.5) / a
    	else:
    		tmp = (c / b) * -0.5
    	return tmp
    
    function code(a, b, c)
    	tmp = 0.0
    	if (b <= 8.6e-308)
    		tmp = Float64(Float64(b / -1.5) / a);
    	else
    		tmp = Float64(Float64(c / b) * -0.5);
    	end
    	return tmp
    end
    
    function tmp_2 = code(a, b, c)
    	tmp = 0.0;
    	if (b <= 8.6e-308)
    		tmp = (b / -1.5) / a;
    	else
    		tmp = (c / b) * -0.5;
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := If[LessEqual[b, 8.6e-308], N[(N[(b / -1.5), $MachinePrecision] / a), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq 8.6 \cdot 10^{-308}:\\
    \;\;\;\;\frac{\frac{b}{-1.5}}{a}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{c}{b} \cdot -0.5\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if b < 8.60000000000000041e-308

      1. Initial program 67.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 70.6%

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
      3. Step-by-step derivation
        1. *-commutative70.6%

          \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      4. Simplified70.6%

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      5. Step-by-step derivation
        1. *-commutative70.6%

          \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
        2. metadata-eval70.6%

          \[\leadsto \color{blue}{\frac{1}{-1.5}} \cdot \frac{b}{a} \]
        3. times-frac70.5%

          \[\leadsto \color{blue}{\frac{1 \cdot b}{-1.5 \cdot a}} \]
        4. *-un-lft-identity70.5%

          \[\leadsto \frac{\color{blue}{b}}{-1.5 \cdot a} \]
        5. associate-/r*70.6%

          \[\leadsto \color{blue}{\frac{\frac{b}{-1.5}}{a}} \]
      6. Applied egg-rr70.6%

        \[\leadsto \color{blue}{\frac{\frac{b}{-1.5}}{a}} \]

      if 8.60000000000000041e-308 < b

      1. Initial program 30.7%

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 8.6 \cdot 10^{-308}:\\ \;\;\;\;\frac{\frac{b}{-1.5}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

    Alternative 8: 34.7% accurate, 23.2× speedup?

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

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

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

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

    Reproduce

    ?
    herbie shell --seed 2023333 
    (FPCore (a b c)
      :name "Cubic critical"
      :precision binary64
      (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))