Cubic critical

Percentage Accurate: 52.2% → 84.6%
Time: 9.9s
Alternatives: 10
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 10 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 52.2% 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: 84.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -6.8 \cdot 10^{+53}:\\ \;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 5.8 \cdot 10^{-40}:\\ \;\;\;\;\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 -6.8e+53)
   (+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
   (if (<= b 5.8e-40)
     (/ (- (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 <= -6.8e+53) {
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
	} else if (b <= 5.8e-40) {
		tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-6.8d+53)) then
        tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
    else if (b <= 5.8d-40) then
        tmp = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
    else
        tmp = (c / b) * (-0.5d0)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -6.8e+53) {
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
	} else if (b <= 5.8e-40) {
		tmp = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -6.8e+53:
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b))
	elif b <= 5.8e-40:
		tmp = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)
	else:
		tmp = (c / b) * -0.5
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -6.8e+53)
		tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b)));
	elseif (b <= 5.8e-40)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0));
	else
		tmp = Float64(Float64(c / b) * -0.5);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -6.8e+53)
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
	elseif (b <= 5.8e-40)
		tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	else
		tmp = (c / b) * -0.5;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -6.8e+53], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.8e-40], 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 -6.8 \cdot 10^{+53}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\

\mathbf{elif}\;b \leq 5.8 \cdot 10^{-40}:\\
\;\;\;\;\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 < -6.79999999999999995e53

    1. Initial program 63.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} + 0.5 \cdot \frac{c}{b} \]
    6. Applied egg-rr95.0%

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

    if -6.79999999999999995e53 < b < 5.7999999999999998e-40

    1. Initial program 86.5%

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

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

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

        \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      4. sub0-neg86.5%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\frac{a}{0.3333333333333333}}} \]
    4. Step-by-step derivation
      1. associate-*r*86.4%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b - a \cdot \left(c \cdot 3\right)}} - b}{\frac{a}{0.3333333333333333}} \]
    8. Step-by-step derivation
      1. div-inv86.3%

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

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

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{b \cdot b - \color{blue}{c \cdot \left(a \cdot 3\right)}} - b\right) \cdot \frac{1}{a \cdot 3} \]
    13. Step-by-step derivation
      1. un-div-inv86.5%

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

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

    if 5.7999999999999998e-40 < b

    1. Initial program 13.8%

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

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

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

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

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

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

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

Alternative 2: 84.5% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 64.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} + 0.5 \cdot \frac{c}{b} \]
    6. Applied egg-rr95.1%

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

    if -1.5e51 < b < 5.7999999999999998e-40

    1. Initial program 86.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. neg-sub086.4%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\frac{a}{0.3333333333333333}}} \]
    4. Step-by-step derivation
      1. associate-*r*86.3%

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot \color{blue}{\left(-3\right)}\right)} - b}{\frac{a}{0.3333333333333333}} \]
      3. distribute-rgt-neg-in86.3%

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

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

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

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

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

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

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

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

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

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

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

    if 5.7999999999999998e-40 < b

    1. Initial program 13.8%

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

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

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

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

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

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

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

Alternative 3: 84.5% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 64.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} + 0.5 \cdot \frac{c}{b} \]
    6. Applied egg-rr95.1%

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

    if -1.5e51 < b < 5.5999999999999999e-40

    1. Initial program 86.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. neg-sub086.4%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\frac{a}{0.3333333333333333}}} \]
    4. Step-by-step derivation
      1. associate-*r*86.3%

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot \color{blue}{\left(-3\right)}\right)} - b}{\frac{a}{0.3333333333333333}} \]
      3. distribute-rgt-neg-in86.3%

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

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

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

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

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

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

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

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

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

    if 5.5999999999999999e-40 < b

    1. Initial program 13.8%

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

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

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

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

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

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

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

Alternative 4: 80.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -4.8 \cdot 10^{-90}:\\ \;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 1.1 \cdot 10^{-97}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -4.8e-90)
   (+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
   (if (<= b 1.1e-97)
     (/ (- (sqrt (* a (* c -3.0))) b) (* a 3.0))
     (* (/ c b) -0.5))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -4.8e-90) {
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
	} else if (b <= 1.1e-97) {
		tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0);
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-4.8d-90)) then
        tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
    else if (b <= 1.1d-97) then
        tmp = (sqrt((a * (c * (-3.0d0)))) - b) / (a * 3.0d0)
    else
        tmp = (c / b) * (-0.5d0)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -4.8e-90) {
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
	} else if (b <= 1.1e-97) {
		tmp = (Math.sqrt((a * (c * -3.0))) - b) / (a * 3.0);
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -4.8e-90:
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b))
	elif b <= 1.1e-97:
		tmp = (math.sqrt((a * (c * -3.0))) - b) / (a * 3.0)
	else:
		tmp = (c / b) * -0.5
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -4.8e-90)
		tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b)));
	elseif (b <= 1.1e-97)
		tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / Float64(a * 3.0));
	else
		tmp = Float64(Float64(c / b) * -0.5);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -4.8e-90)
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
	elseif (b <= 1.1e-97)
		tmp = (sqrt((a * (c * -3.0))) - b) / (a * 3.0);
	else
		tmp = (c / b) * -0.5;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -4.8e-90], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.1e-97], N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 76.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} + 0.5 \cdot \frac{c}{b} \]
    6. Applied egg-rr87.3%

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

    if -4.8000000000000003e-90 < b < 1.0999999999999999e-97

    1. Initial program 85.1%

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

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

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

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

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

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

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

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

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

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

    if 1.0999999999999999e-97 < b

    1. Initial program 16.6%

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

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

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

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

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

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

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

Alternative 5: 67.6% accurate, 8.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -4 \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 -4e-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 <= -4e-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 <= (-4d-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 <= -4e-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 <= -4e-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 <= -4e-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 <= -4e-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, -4e-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 -4 \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 < -3.999999999999988e-310

    1. Initial program 78.3%

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

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

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

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

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

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

    if -3.999999999999988e-310 < b

    1. Initial program 33.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. sqr-neg33.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4 \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.6% accurate, 8.9× speedup?

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

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


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

    1. Initial program 78.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} + 0.5 \cdot \frac{c}{b} \]
    6. Applied egg-rr73.0%

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

    if -3.999999999999988e-310 < b

    1. Initial program 33.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. sqr-neg33.0%

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

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

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

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

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

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

Alternative 7: 67.5% accurate, 16.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.5 \cdot 10^{-308}:\\
\;\;\;\;b \cdot \frac{-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 < 1.4999999999999999e-308

    1. Initial program 78.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\frac{a}{0.3333333333333333}}} \]
    4. Step-by-step derivation
      1. associate-*r*78.3%

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot \color{blue}{\left(-3\right)}\right)} - b}{\frac{a}{0.3333333333333333}} \]
      3. distribute-rgt-neg-in78.3%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b - a \cdot \left(c \cdot 3\right)}} - b}{\frac{a}{0.3333333333333333}} \]
    8. Step-by-step derivation
      1. div-inv78.1%

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)} - b\right) \cdot \frac{1}{a \cdot 3}} \]
    10. Taylor expanded in b around -inf 72.6%

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
    11. Step-by-step derivation
      1. associate-*r/72.7%

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
    12. Simplified72.7%

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

    if 1.4999999999999999e-308 < b

    1. Initial program 33.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. sqr-neg33.0%

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

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

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

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

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

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

Alternative 8: 67.5% accurate, 16.4× speedup?

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

    1. Initial program 78.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\frac{a}{0.3333333333333333}}} \]
    4. Step-by-step derivation
      1. associate-*r*78.3%

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot \color{blue}{\left(-3\right)}\right)} - b}{\frac{a}{0.3333333333333333}} \]
      3. distribute-rgt-neg-in78.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
    9. Step-by-step derivation
      1. associate-*r/72.7%

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    10. Simplified72.7%

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

    if -3.999999999999988e-310 < b

    1. Initial program 33.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. sqr-neg33.0%

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

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

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

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

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

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

Alternative 9: 67.5% accurate, 16.4× speedup?

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

    1. Initial program 78.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\frac{a}{0.3333333333333333}}} \]
    4. Step-by-step derivation
      1. associate-*r*78.3%

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot \color{blue}{\left(-3\right)}\right)} - b}{\frac{a}{0.3333333333333333}} \]
      3. distribute-rgt-neg-in78.3%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b - a \cdot \left(c \cdot 3\right)}} - b}{\frac{a}{0.3333333333333333}} \]
    8. Step-by-step derivation
      1. div-inv78.1%

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)} - b\right) \cdot \frac{1}{a \cdot 3}} \]
    10. Taylor expanded in b around -inf 72.6%

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
    11. Step-by-step derivation
      1. associate-*r/72.7%

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
    12. Simplified72.7%

      \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
    13. Step-by-step derivation
      1. associate-*l/72.7%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} \]
      2. *-commutative72.7%

        \[\leadsto \frac{\color{blue}{b \cdot -0.6666666666666666}}{a} \]
    14. Applied egg-rr72.7%

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

    if -3.999999999999988e-310 < b

    1. Initial program 33.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. sqr-neg33.0%

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

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

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

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

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

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

Alternative 10: 34.9% 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 55.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. sqr-neg55.0%

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

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

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

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

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

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

Reproduce

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