Cubic critical

Percentage Accurate: 52.3% → 86.1%
Time: 14.8s
Alternatives: 11
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 11 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: 52.3% accurate, 1.0× speedup?

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

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

Alternative 1: 86.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5.5 \cdot 10^{+119}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{-69}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\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 -5.5e+119)
   (fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
   (if (<= b 8.5e-69)
     (/ (- (sqrt (fma 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 <= -5.5e+119) {
		tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
	} else if (b <= 8.5e-69) {
		tmp = (sqrt(fma(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 <= -5.5e+119)
		tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b)));
	elseif (b <= 8.5e-69)
		tmp = Float64(Float64(sqrt(fma(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
code[a_, b_, c_] := If[LessEqual[b, -5.5e+119], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.5e-69], N[(N[(N[Sqrt[N[(b * b + 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.5 \cdot 10^{+119}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\

\mathbf{elif}\;b \leq 8.5 \cdot 10^{-69}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\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 < -5.5000000000000003e119

    1. Initial program 43.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 97.5%

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. fma-def97.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)} \]
    4. Simplified97.5%

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

    if -5.5000000000000003e119 < b < 8.50000000000000046e-69

    1. Initial program 80.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. Simplified80.0%

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

      if 8.50000000000000046e-69 < b

      1. Initial program 12.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 90.3%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.5 \cdot 10^{+119}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{-69}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

    Alternative 2: 86.2% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.6 \cdot 10^{+119}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 5.4 \cdot 10^{-65}:\\ \;\;\;\;\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 -2.6e+119)
       (fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
       (if (<= b 5.4e-65)
         (/ (- (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 <= -2.6e+119) {
    		tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
    	} else if (b <= 5.4e-65) {
    		tmp = (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 <= -2.6e+119)
    		tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b)));
    	elseif (b <= 5.4e-65)
    		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
    
    code[a_, b_, c_] := If[LessEqual[b, -2.6e+119], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.4e-65], 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 -2.6 \cdot 10^{+119}:\\
    \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
    
    \mathbf{elif}\;b \leq 5.4 \cdot 10^{-65}:\\
    \;\;\;\;\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 < -2.6e119

      1. Initial program 43.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 97.5%

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
      3. Step-by-step derivation
        1. fma-def97.5%

          \[\leadsto \color{blue}{\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)} \]
      4. Simplified97.5%

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

      if -2.6e119 < b < 5.3999999999999997e-65

      1. Initial program 80.0%

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

      if 5.3999999999999997e-65 < b

      1. Initial program 12.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 90.3%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.6 \cdot 10^{+119}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 5.4 \cdot 10^{-65}:\\ \;\;\;\;\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 3: 80.7% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-74}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 1.9 \cdot 10^{-117}:\\ \;\;\;\;\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 -2e-74)
       (fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
       (if (<= b 1.9e-117)
         (/ (- (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 <= -2e-74) {
    		tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
    	} else if (b <= 1.9e-117) {
    		tmp = (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 <= -2e-74)
    		tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b)));
    	elseif (b <= 1.9e-117)
    		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
    
    code[a_, b_, c_] := If[LessEqual[b, -2e-74], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.9e-117], 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 -2 \cdot 10^{-74}:\\
    \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
    
    \mathbf{elif}\;b \leq 1.9 \cdot 10^{-117}:\\
    \;\;\;\;\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 < -1.99999999999999992e-74

      1. Initial program 66.5%

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

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
      3. Step-by-step derivation
        1. fma-def91.1%

          \[\leadsto \color{blue}{\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)} \]
      4. Simplified91.1%

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

      if -1.99999999999999992e-74 < b < 1.89999999999999986e-117

      1. Initial program 74.3%

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

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

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

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

      if 1.89999999999999986e-117 < b

      1. Initial program 16.5%

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-74}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 1.9 \cdot 10^{-117}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

    Alternative 4: 68.0% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= b -5e-310)
       (fma -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 = fma(-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 = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b)));
    	else
    		tmp = Float64(Float64(c / b) * -0.5);
    	end
    	return tmp
    end
    
    code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(-0.6666666666666666 * N[(b / a), $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}:\\
    \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\
    
    \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 71.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 67.5%

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
      3. Step-by-step derivation
        1. fma-def67.5%

          \[\leadsto \color{blue}{\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)} \]
      4. Simplified67.5%

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

      if -4.999999999999985e-310 < b

      1. Initial program 28.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 69.3%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \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.5 \cdot \frac{c}{b} + -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.5 (/ c b)) (* -0.6666666666666666 (/ b a)))
       (* (/ c b) -0.5)))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -5e-310) {
    		tmp = (0.5 * (c / b)) + (-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.5d0 * (c / b)) + ((-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.5 * (c / b)) + (-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.5 * (c / b)) + (-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(Float64(0.5 * Float64(c / b)) + 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.5 * (c / b)) + (-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[(N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision] + N[(-0.6666666666666666 * N[(b / a), $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.5 \cdot \frac{c}{b} + -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 71.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 67.5%

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

      if -4.999999999999985e-310 < b

      1. Initial program 28.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 69.3%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{a}\\ \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 71.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 67.2%

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

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

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

      if -4.999999999999985e-310 < b

      1. Initial program 28.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 69.3%

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

      \[\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.8% accurate, 16.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{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 (/ a b)) (* (/ c b) -0.5)))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -5e-310) {
    		tmp = -0.6666666666666666 / (a / 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) / (a / 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 / (a / b);
    	} else {
    		tmp = (c / b) * -0.5;
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	tmp = 0
    	if b <= -5e-310:
    		tmp = -0.6666666666666666 / (a / b)
    	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(a / 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 / (a / b);
    	else
    		tmp = (c / b) * -0.5;
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
    \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{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 71.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 67.2%

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

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

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

          \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
        2. associate-*r/67.2%

          \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} \]
        3. associate-/l*67.2%

          \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
      6. Applied egg-rr67.2%

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

      if -4.999999999999985e-310 < b

      1. Initial program 28.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 69.3%

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

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

    Alternative 8: 67.8% accurate, 16.4× speedup?

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

      1. Initial program 71.2%

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\left(-b\right) + {\color{blue}{\left({\left(\mathsf{fma}\left(a, c \cdot -3, b \cdot b\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2}}{3 \cdot a} \]
        12. 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} \]
        13. 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 b around -inf 67.2%

        \[\leadsto \color{blue}{2 \cdot \left(-0.3333333333333333 \cdot \frac{b}{a}\right)} \]
      5. Step-by-step derivation
        1. associate-*r*67.2%

          \[\leadsto \color{blue}{\left(2 \cdot -0.3333333333333333\right) \cdot \frac{b}{a}} \]
        2. metadata-eval67.2%

          \[\leadsto \color{blue}{-0.6666666666666666} \cdot \frac{b}{a} \]
        3. associate-*r/67.2%

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

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

      if 3.99999999999979e-311 < b

      1. Initial program 28.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 69.3%

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

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

    Alternative 9: 67.9% accurate, 16.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\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 -5e-310) (/ (/ b -1.5) a) (* (/ c b) -0.5)))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -5e-310) {
    		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 <= (-5d-310)) 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 <= -5e-310) {
    		tmp = (b / -1.5) / a;
    	} else {
    		tmp = (c / b) * -0.5;
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	tmp = 0
    	if b <= -5e-310:
    		tmp = (b / -1.5) / a
    	else:
    		tmp = (c / b) * -0.5
    	return tmp
    
    function code(a, b, c)
    	tmp = 0.0
    	if (b <= -5e-310)
    		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 <= -5e-310)
    		tmp = (b / -1.5) / a;
    	else
    		tmp = (c / b) * -0.5;
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := If[LessEqual[b, -5e-310], 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 -5 \cdot 10^{-310}:\\
    \;\;\;\;\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 < -4.999999999999985e-310

      1. Initial program 71.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 67.2%

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      5. Step-by-step derivation
        1. metadata-eval67.2%

          \[\leadsto \frac{b}{a} \cdot \color{blue}{\frac{-2}{3}} \]
        2. times-frac67.3%

          \[\leadsto \color{blue}{\frac{b \cdot -2}{a \cdot 3}} \]
        3. associate-/l/67.4%

          \[\leadsto \color{blue}{\frac{\frac{b \cdot -2}{3}}{a}} \]
        4. associate-/l*67.4%

          \[\leadsto \frac{\color{blue}{\frac{b}{\frac{3}{-2}}}}{a} \]
        5. metadata-eval67.4%

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

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

      if -4.999999999999985e-310 < b

      1. Initial program 28.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 69.3%

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

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

    Alternative 10: 34.3% 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.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 34.4%

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

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

    Alternative 11: 11.3% accurate, 116.0× speedup?

    \[\begin{array}{l} \\ 0 \end{array} \]
    (FPCore (a b c) :precision binary64 0.0)
    double code(double a, double b, double c) {
    	return 0.0;
    }
    
    real(8) function code(a, b, c)
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: c
        code = 0.0d0
    end function
    
    public static double code(double a, double b, double c) {
    	return 0.0;
    }
    
    def code(a, b, c):
    	return 0.0
    
    function code(a, b, c)
    	return 0.0
    end
    
    function tmp = code(a, b, c)
    	tmp = 0.0;
    end
    
    code[a_, b_, c_] := 0.0
    
    \begin{array}{l}
    
    \\
    0
    \end{array}
    
    Derivation
    1. Initial program 50.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 26.6%

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a} \]
    3. Step-by-step derivation
      1. frac-2neg26.6%

        \[\leadsto \color{blue}{\frac{--1.5 \cdot \frac{a \cdot c}{b}}{-3 \cdot a}} \]
      2. distribute-frac-neg26.6%

        \[\leadsto \color{blue}{-\frac{-1.5 \cdot \frac{a \cdot c}{b}}{-3 \cdot a}} \]
      3. frac-2neg26.6%

        \[\leadsto -\frac{-1.5 \cdot \color{blue}{\frac{-a \cdot c}{-b}}}{-3 \cdot a} \]
      4. distribute-frac-neg26.6%

        \[\leadsto -\frac{-1.5 \cdot \color{blue}{\left(-\frac{a \cdot c}{-b}\right)}}{-3 \cdot a} \]
      5. add-sqr-sqrt1.1%

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

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

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

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

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

        \[\leadsto -\frac{-1.5 \cdot \left(-\frac{a \cdot c}{\color{blue}{\sqrt{b} \cdot \sqrt{b}}}\right)}{-3 \cdot a} \]
      11. add-sqr-sqrt9.7%

        \[\leadsto -\frac{-1.5 \cdot \left(-\frac{a \cdot c}{\color{blue}{b}}\right)}{-3 \cdot a} \]
      12. distribute-rgt-neg-in9.7%

        \[\leadsto -\frac{\color{blue}{--1.5 \cdot \frac{a \cdot c}{b}}}{-3 \cdot a} \]
      13. frac-2neg9.7%

        \[\leadsto -\color{blue}{\frac{-1.5 \cdot \frac{a \cdot c}{b}}{3 \cdot a}} \]
      14. times-frac9.7%

        \[\leadsto -\color{blue}{\frac{-1.5}{3} \cdot \frac{\frac{a \cdot c}{b}}{a}} \]
      15. metadata-eval9.7%

        \[\leadsto -\color{blue}{-0.5} \cdot \frac{\frac{a \cdot c}{b}}{a} \]
      16. associate-*r/9.7%

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

        \[\leadsto -\frac{-0.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}}{a} \]
      18. associate-/r/9.6%

        \[\leadsto -\frac{-0.5 \cdot \color{blue}{\left(\frac{a}{b} \cdot c\right)}}{a} \]
    4. Applied egg-rr9.6%

      \[\leadsto \color{blue}{-\frac{-0.5 \cdot \left(\frac{a}{b} \cdot c\right)}{a}} \]
    5. Step-by-step derivation
      1. distribute-neg-frac9.6%

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

        \[\leadsto \frac{-\color{blue}{\left(-0.5 \cdot \frac{a}{b}\right) \cdot c}}{a} \]
    6. Simplified9.6%

      \[\leadsto \color{blue}{\frac{-\left(-0.5 \cdot \frac{a}{b}\right) \cdot c}{a}} \]
    7. Step-by-step derivation
      1. div-inv9.6%

        \[\leadsto \color{blue}{\left(-\left(-0.5 \cdot \frac{a}{b}\right) \cdot c\right) \cdot \frac{1}{a}} \]
      2. add-sqr-sqrt7.4%

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

        \[\leadsto \color{blue}{\sqrt{\left(-\left(-0.5 \cdot \frac{a}{b}\right) \cdot c\right) \cdot \left(-\left(-0.5 \cdot \frac{a}{b}\right) \cdot c\right)}} \cdot \frac{1}{a} \]
      4. sqr-neg16.6%

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

        \[\leadsto \color{blue}{\left(\sqrt{\left(-0.5 \cdot \frac{a}{b}\right) \cdot c} \cdot \sqrt{\left(-0.5 \cdot \frac{a}{b}\right) \cdot c}\right)} \cdot \frac{1}{a} \]
      6. add-sqr-sqrt29.0%

        \[\leadsto \color{blue}{\left(\left(-0.5 \cdot \frac{a}{b}\right) \cdot c\right)} \cdot \frac{1}{a} \]
      7. *-commutative29.0%

        \[\leadsto \color{blue}{\left(c \cdot \left(-0.5 \cdot \frac{a}{b}\right)\right)} \cdot \frac{1}{a} \]
    8. Applied egg-rr29.0%

      \[\leadsto \color{blue}{\left(c \cdot \left(-0.5 \cdot \frac{a}{b}\right)\right) \cdot \frac{1}{a}} \]
    9. Simplified9.9%

      \[\leadsto \color{blue}{0} \]
    10. Final simplification9.9%

      \[\leadsto 0 \]

    Reproduce

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