Cubic critical

Percentage Accurate: 53.0% → 85.3%
Time: 12.9s
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: 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.8 \cdot 10^{+134}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 3.5 \cdot 10^{-116}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -5.8e+134)
   (/ b (* a -1.5))
   (if (<= b 3.5e-116)
     (/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
     (/ (* c -0.5) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5.8e+134) {
		tmp = b / (a * -1.5);
	} else if (b <= 3.5e-116) {
		tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.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) :: tmp
    if (b <= (-5.8d+134)) then
        tmp = b / (a * (-1.5d0))
    else if (b <= 3.5d-116) then
        tmp = (sqrt(((b * b) - ((a * 3.0d0) * c))) - b) / (a * 3.0d0)
    else
        tmp = (c * (-0.5d0)) / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -5.8e+134) {
		tmp = b / (a * -1.5);
	} else if (b <= 3.5e-116) {
		tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -5.8e+134:
		tmp = b / (a * -1.5)
	elif b <= 3.5e-116:
		tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0)
	else:
		tmp = (c * -0.5) / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -5.8e+134)
		tmp = Float64(b / Float64(a * -1.5));
	elseif (b <= 3.5e-116)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0));
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -5.8e+134)
		tmp = b / (a * -1.5);
	elseif (b <= 3.5e-116)
		tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
	else
		tmp = (c * -0.5) / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -5.8e+134], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.5e-116], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 3.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.8 \cdot 10^{+134}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\

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

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


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

    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 92.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{b \cdot -2}{a \cdot 3}} \]
      3. *-commutative92.9%

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

        \[\leadsto \color{blue}{\frac{b}{\frac{3 \cdot a}{-2}}} \]
      5. frac-2neg92.9%

        \[\leadsto \color{blue}{\frac{-b}{-\frac{3 \cdot a}{-2}}} \]
      6. add-sqr-sqrt92.5%

        \[\leadsto \frac{\color{blue}{\sqrt{-b} \cdot \sqrt{-b}}}{-\frac{3 \cdot a}{-2}} \]
      7. sqrt-unprod52.6%

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

        \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b}}}{-\frac{3 \cdot a}{-2}} \]
      9. sqrt-unprod0.0%

        \[\leadsto \frac{\color{blue}{\sqrt{b} \cdot \sqrt{b}}}{-\frac{3 \cdot a}{-2}} \]
      10. add-sqr-sqrt0.5%

        \[\leadsto \frac{\color{blue}{b}}{-\frac{3 \cdot a}{-2}} \]
      11. div-inv0.5%

        \[\leadsto \frac{b}{-\color{blue}{\left(3 \cdot a\right) \cdot \frac{1}{-2}}} \]
      12. add-sqr-sqrt0.2%

        \[\leadsto \frac{b}{-\color{blue}{\left(\sqrt{3 \cdot a} \cdot \sqrt{3 \cdot a}\right)} \cdot \frac{1}{-2}} \]
      13. sqrt-unprod38.2%

        \[\leadsto \frac{b}{-\color{blue}{\sqrt{\left(3 \cdot a\right) \cdot \left(3 \cdot a\right)}} \cdot \frac{1}{-2}} \]
      14. *-commutative38.2%

        \[\leadsto \frac{b}{-\sqrt{\color{blue}{\left(a \cdot 3\right)} \cdot \left(3 \cdot a\right)} \cdot \frac{1}{-2}} \]
      15. *-commutative38.2%

        \[\leadsto \frac{b}{-\sqrt{\left(a \cdot 3\right) \cdot \color{blue}{\left(a \cdot 3\right)}} \cdot \frac{1}{-2}} \]
      16. swap-sqr38.2%

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

        \[\leadsto \frac{b}{-\sqrt{\left(a \cdot a\right) \cdot \color{blue}{9}} \cdot \frac{1}{-2}} \]
      18. metadata-eval38.2%

        \[\leadsto \frac{b}{-\sqrt{\left(a \cdot a\right) \cdot \color{blue}{\left(-3 \cdot -3\right)}} \cdot \frac{1}{-2}} \]
      19. swap-sqr38.2%

        \[\leadsto \frac{b}{-\sqrt{\color{blue}{\left(a \cdot -3\right) \cdot \left(a \cdot -3\right)}} \cdot \frac{1}{-2}} \]
      20. sqrt-unprod45.1%

        \[\leadsto \frac{b}{-\color{blue}{\left(\sqrt{a \cdot -3} \cdot \sqrt{a \cdot -3}\right)} \cdot \frac{1}{-2}} \]
      21. add-sqr-sqrt92.9%

        \[\leadsto \frac{b}{-\color{blue}{\left(a \cdot -3\right)} \cdot \frac{1}{-2}} \]
      22. metadata-eval92.9%

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

      \[\leadsto \color{blue}{\frac{b}{-\left(a \cdot -3\right) \cdot -0.5}} \]
    7. Step-by-step derivation
      1. associate-*l*92.9%

        \[\leadsto \frac{b}{-\color{blue}{a \cdot \left(-3 \cdot -0.5\right)}} \]
      2. metadata-eval92.9%

        \[\leadsto \frac{b}{-a \cdot \color{blue}{1.5}} \]
      3. distribute-rgt-neg-in92.9%

        \[\leadsto \frac{b}{\color{blue}{a \cdot \left(-1.5\right)}} \]
      4. metadata-eval92.9%

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    8. Simplified92.9%

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

    if -5.80000000000000023e134 < b < 3.49999999999999984e-116

    1. Initial program 88.8%

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

    if 3.49999999999999984e-116 < b

    1. Initial program 17.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.8 \cdot 10^{+134}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 3.5 \cdot 10^{-116}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 2: 80.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.15 \cdot 10^{-69}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{-3}}{a}\\

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

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


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

    1. Initial program 78.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Applied egg-rr8.1%

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

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

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

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

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

    if -1.15e-69 < b < 3.49999999999999984e-116

    1. Initial program 79.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 0 77.7%

      \[\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*77.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(b + \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def59.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(b + \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a}\right)\right)} \]
      2. expm1-log1p77.1%

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

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

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

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

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

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

    if 3.49999999999999984e-116 < b

    1. Initial program 17.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.15 \cdot 10^{-69}:\\ \;\;\;\;\frac{\frac{b \cdot 2}{-3}}{a}\\ \mathbf{elif}\;b \leq 3.5 \cdot 10^{-116}:\\ \;\;\;\;\left(b + \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 3: 80.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.7 \cdot 10^{-67}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{-3}}{a}\\

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

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


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

    1. Initial program 78.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Applied egg-rr8.1%

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

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

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

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

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

    if -2.70000000000000016e-67 < b < 3.49999999999999984e-116

    1. Initial program 79.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 0 77.7%

      \[\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*77.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.49999999999999984e-116 < b

    1. Initial program 17.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 80.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.3 \cdot 10^{-53}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{-3}}{a}\\

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

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


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

    1. Initial program 78.4%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Applied egg-rr7.1%

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{b \cdot 2}}{-3}}{a} \]
    6. Simplified90.4%

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

    if -3.30000000000000004e-53 < b < 2.7999999999999999e-116

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

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

    if 2.7999999999999999e-116 < b

    1. Initial program 17.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 80.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.4 \cdot 10^{-52}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{-3}}{a}\\

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

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


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

    1. Initial program 78.4%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Applied egg-rr7.1%

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{b \cdot 2}}{-3}}{a} \]
    6. Simplified90.4%

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

    if -6.4000000000000002e-52 < b < 3.49999999999999984e-116

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

      \[\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*77.2%

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

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

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

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

    if 3.49999999999999984e-116 < b

    1. Initial program 17.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 67.1% accurate, 12.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.6 \cdot 10^{-287}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{-3}}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.6e-287

    1. Initial program 80.4%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Applied egg-rr29.1%

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{b \cdot 2}}{-3}}{a} \]
    6. Simplified66.5%

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

    if 2.6e-287 < b

    1. Initial program 28.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. fma-neg28.2%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{3 \cdot \left(a \cdot c\right)}\right)}}{3 \cdot a} \]
      3. distribute-lft-neg-in28.2%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 2.6 \cdot 10^{-287}:\\ \;\;\;\;\frac{\frac{b \cdot 2}{-3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 7: 67.1% accurate, 16.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.6 \cdot 10^{-287}:\\ \;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 2.6e-287) (* b (/ -0.6666666666666666 a)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 2.6e-287) {
		tmp = b * (-0.6666666666666666 / a);
	} else {
		tmp = -0.5 * (c / b);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= 2.6d-287) then
        tmp = b * ((-0.6666666666666666d0) / a)
    else
        tmp = (-0.5d0) * (c / b)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= 2.6e-287) {
		tmp = b * (-0.6666666666666666 / a);
	} else {
		tmp = -0.5 * (c / b);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 2.6e-287:
		tmp = b * (-0.6666666666666666 / a)
	else:
		tmp = -0.5 * (c / b)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 2.6e-287)
		tmp = Float64(b * Float64(-0.6666666666666666 / a));
	else
		tmp = Float64(-0.5 * Float64(c / b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= 2.6e-287)
		tmp = b * (-0.6666666666666666 / a);
	else
		tmp = -0.5 * (c / b);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, 2.6e-287], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.6 \cdot 10^{-287}:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.6e-287

    1. Initial program 80.4%

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{3 \cdot \left(a \cdot c\right)}\right)}}{3 \cdot a} \]
      3. distribute-lft-neg-in80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    8. Simplified66.3%

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

    if 2.6e-287 < b

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

      \[\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 2.6 \cdot 10^{-287}:\\ \;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]

Alternative 8: 67.1% accurate, 16.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.6 \cdot 10^{-287}:\\ \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 2.6e-287) (/ -0.6666666666666666 (/ a b)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 2.6e-287) {
		tmp = -0.6666666666666666 / (a / b);
	} else {
		tmp = -0.5 * (c / b);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= 2.6d-287) then
        tmp = (-0.6666666666666666d0) / (a / b)
    else
        tmp = (-0.5d0) * (c / b)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= 2.6e-287) {
		tmp = -0.6666666666666666 / (a / b);
	} else {
		tmp = -0.5 * (c / b);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 2.6e-287:
		tmp = -0.6666666666666666 / (a / b)
	else:
		tmp = -0.5 * (c / b)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 2.6e-287)
		tmp = Float64(-0.6666666666666666 / Float64(a / b));
	else
		tmp = Float64(-0.5 * Float64(c / b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= 2.6e-287)
		tmp = -0.6666666666666666 / (a / b);
	else
		tmp = -0.5 * (c / b);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, 2.6e-287], N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.6 \cdot 10^{-287}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.6e-287

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

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

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

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

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

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
      3. un-div-inv66.3%

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

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

    if 2.6e-287 < b

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

      \[\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 2.6 \cdot 10^{-287}:\\ \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]

Alternative 9: 67.1% accurate, 16.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.6 \cdot 10^{-287}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 2.6e-287) (/ b (* a -1.5)) (* -0.5 (/ c b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 2.6e-287) {
		tmp = b / (a * -1.5);
	} else {
		tmp = -0.5 * (c / b);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= 2.6d-287) then
        tmp = b / (a * (-1.5d0))
    else
        tmp = (-0.5d0) * (c / b)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= 2.6e-287) {
		tmp = b / (a * -1.5);
	} else {
		tmp = -0.5 * (c / b);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 2.6e-287:
		tmp = b / (a * -1.5)
	else:
		tmp = -0.5 * (c / b)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 2.6e-287)
		tmp = Float64(b / Float64(a * -1.5));
	else
		tmp = Float64(-0.5 * Float64(c / b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= 2.6e-287)
		tmp = b / (a * -1.5);
	else
		tmp = -0.5 * (c / b);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, 2.6e-287], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.6 \cdot 10^{-287}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.6e-287

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b \cdot -2}{a \cdot 3}} \]
      3. *-commutative66.4%

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

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

        \[\leadsto \color{blue}{\frac{-b}{-\frac{3 \cdot a}{-2}}} \]
      6. add-sqr-sqrt66.2%

        \[\leadsto \frac{\color{blue}{\sqrt{-b} \cdot \sqrt{-b}}}{-\frac{3 \cdot a}{-2}} \]
      7. sqrt-unprod52.9%

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

        \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b}}}{-\frac{3 \cdot a}{-2}} \]
      9. sqrt-unprod0.1%

        \[\leadsto \frac{\color{blue}{\sqrt{b} \cdot \sqrt{b}}}{-\frac{3 \cdot a}{-2}} \]
      10. add-sqr-sqrt1.4%

        \[\leadsto \frac{\color{blue}{b}}{-\frac{3 \cdot a}{-2}} \]
      11. div-inv1.4%

        \[\leadsto \frac{b}{-\color{blue}{\left(3 \cdot a\right) \cdot \frac{1}{-2}}} \]
      12. add-sqr-sqrt0.7%

        \[\leadsto \frac{b}{-\color{blue}{\left(\sqrt{3 \cdot a} \cdot \sqrt{3 \cdot a}\right)} \cdot \frac{1}{-2}} \]
      13. sqrt-unprod29.1%

        \[\leadsto \frac{b}{-\color{blue}{\sqrt{\left(3 \cdot a\right) \cdot \left(3 \cdot a\right)}} \cdot \frac{1}{-2}} \]
      14. *-commutative29.1%

        \[\leadsto \frac{b}{-\sqrt{\color{blue}{\left(a \cdot 3\right)} \cdot \left(3 \cdot a\right)} \cdot \frac{1}{-2}} \]
      15. *-commutative29.1%

        \[\leadsto \frac{b}{-\sqrt{\left(a \cdot 3\right) \cdot \color{blue}{\left(a \cdot 3\right)}} \cdot \frac{1}{-2}} \]
      16. swap-sqr29.1%

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

        \[\leadsto \frac{b}{-\sqrt{\left(a \cdot a\right) \cdot \color{blue}{9}} \cdot \frac{1}{-2}} \]
      18. metadata-eval29.1%

        \[\leadsto \frac{b}{-\sqrt{\left(a \cdot a\right) \cdot \color{blue}{\left(-3 \cdot -3\right)}} \cdot \frac{1}{-2}} \]
      19. swap-sqr29.1%

        \[\leadsto \frac{b}{-\sqrt{\color{blue}{\left(a \cdot -3\right) \cdot \left(a \cdot -3\right)}} \cdot \frac{1}{-2}} \]
      20. sqrt-unprod32.6%

        \[\leadsto \frac{b}{-\color{blue}{\left(\sqrt{a \cdot -3} \cdot \sqrt{a \cdot -3}\right)} \cdot \frac{1}{-2}} \]
      21. add-sqr-sqrt66.4%

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

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

      \[\leadsto \color{blue}{\frac{b}{-\left(a \cdot -3\right) \cdot -0.5}} \]
    7. Step-by-step derivation
      1. associate-*l*66.4%

        \[\leadsto \frac{b}{-\color{blue}{a \cdot \left(-3 \cdot -0.5\right)}} \]
      2. metadata-eval66.4%

        \[\leadsto \frac{b}{-a \cdot \color{blue}{1.5}} \]
      3. distribute-rgt-neg-in66.4%

        \[\leadsto \frac{b}{\color{blue}{a \cdot \left(-1.5\right)}} \]
      4. metadata-eval66.4%

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    8. Simplified66.4%

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

    if 2.6e-287 < b

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

      \[\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 2.6 \cdot 10^{-287}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]

Alternative 10: 67.1% accurate, 16.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.6 \cdot 10^{-287}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.6e-287

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b \cdot -2}{a \cdot 3}} \]
      3. *-commutative66.4%

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

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

        \[\leadsto \color{blue}{\frac{-b}{-\frac{3 \cdot a}{-2}}} \]
      6. add-sqr-sqrt66.2%

        \[\leadsto \frac{\color{blue}{\sqrt{-b} \cdot \sqrt{-b}}}{-\frac{3 \cdot a}{-2}} \]
      7. sqrt-unprod52.9%

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

        \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b}}}{-\frac{3 \cdot a}{-2}} \]
      9. sqrt-unprod0.1%

        \[\leadsto \frac{\color{blue}{\sqrt{b} \cdot \sqrt{b}}}{-\frac{3 \cdot a}{-2}} \]
      10. add-sqr-sqrt1.4%

        \[\leadsto \frac{\color{blue}{b}}{-\frac{3 \cdot a}{-2}} \]
      11. div-inv1.4%

        \[\leadsto \frac{b}{-\color{blue}{\left(3 \cdot a\right) \cdot \frac{1}{-2}}} \]
      12. add-sqr-sqrt0.7%

        \[\leadsto \frac{b}{-\color{blue}{\left(\sqrt{3 \cdot a} \cdot \sqrt{3 \cdot a}\right)} \cdot \frac{1}{-2}} \]
      13. sqrt-unprod29.1%

        \[\leadsto \frac{b}{-\color{blue}{\sqrt{\left(3 \cdot a\right) \cdot \left(3 \cdot a\right)}} \cdot \frac{1}{-2}} \]
      14. *-commutative29.1%

        \[\leadsto \frac{b}{-\sqrt{\color{blue}{\left(a \cdot 3\right)} \cdot \left(3 \cdot a\right)} \cdot \frac{1}{-2}} \]
      15. *-commutative29.1%

        \[\leadsto \frac{b}{-\sqrt{\left(a \cdot 3\right) \cdot \color{blue}{\left(a \cdot 3\right)}} \cdot \frac{1}{-2}} \]
      16. swap-sqr29.1%

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

        \[\leadsto \frac{b}{-\sqrt{\left(a \cdot a\right) \cdot \color{blue}{9}} \cdot \frac{1}{-2}} \]
      18. metadata-eval29.1%

        \[\leadsto \frac{b}{-\sqrt{\left(a \cdot a\right) \cdot \color{blue}{\left(-3 \cdot -3\right)}} \cdot \frac{1}{-2}} \]
      19. swap-sqr29.1%

        \[\leadsto \frac{b}{-\sqrt{\color{blue}{\left(a \cdot -3\right) \cdot \left(a \cdot -3\right)}} \cdot \frac{1}{-2}} \]
      20. sqrt-unprod32.6%

        \[\leadsto \frac{b}{-\color{blue}{\left(\sqrt{a \cdot -3} \cdot \sqrt{a \cdot -3}\right)} \cdot \frac{1}{-2}} \]
      21. add-sqr-sqrt66.4%

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

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

      \[\leadsto \color{blue}{\frac{b}{-\left(a \cdot -3\right) \cdot -0.5}} \]
    7. Step-by-step derivation
      1. associate-*l*66.4%

        \[\leadsto \frac{b}{-\color{blue}{a \cdot \left(-3 \cdot -0.5\right)}} \]
      2. metadata-eval66.4%

        \[\leadsto \frac{b}{-a \cdot \color{blue}{1.5}} \]
      3. distribute-rgt-neg-in66.4%

        \[\leadsto \frac{b}{\color{blue}{a \cdot \left(-1.5\right)}} \]
      4. metadata-eval66.4%

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    8. Simplified66.4%

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

    if 2.6e-287 < b

    1. Initial program 28.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. fma-neg28.2%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{3 \cdot \left(a \cdot c\right)}\right)}}{3 \cdot a} \]
      3. distribute-lft-neg-in28.2%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 34.6% accurate, 23.2× speedup?

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

\\
-0.5 \cdot \frac{c}{b}
\end{array}
Derivation
  1. Initial program 54.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 inf 36.7%

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

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

Reproduce

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