Cubic critical

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

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

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

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


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

    1. Initial program 44.0%

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

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

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

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

    if -9.9999999999999999e144 < b < 3.25000000000000003e-105

    1. Initial program 81.9%

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

    if 3.25000000000000003e-105 < b

    1. Initial program 16.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 89.3%

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

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

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

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

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

Alternative 2: 80.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.05 \cdot 10^{-76}:\\
\;\;\;\;\frac{\left(1.5 \cdot \frac{a}{\frac{b}{c}} - b\right) - b}{3 \cdot a}\\

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

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


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

    1. Initial program 73.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. flip--38.7%

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left({b}^{2} \cdot \color{blue}{{b}^{2}} - \left(\left(3 \cdot a\right) \cdot c\right) \cdot \left(\left(3 \cdot a\right) \cdot c\right)\right) \cdot \frac{1}{b \cdot b + \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
      5. pow-prod-up38.7%

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left({b}^{4} - \color{blue}{{\left(\left(3 \cdot a\right) \cdot c\right)}^{2}}\right) \cdot \frac{1}{b \cdot b + \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
      8. associate-*l*38.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(-1 \cdot b + 1.5 \cdot \frac{a \cdot c}{b}\right)}}{3 \cdot a} \]
    10. Step-by-step derivation
      1. +-commutative76.9%

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

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

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

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

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

    if -2.0499999999999999e-76 < b < 1.05000000000000002e-106

    1. Initial program 73.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. prod-diff72.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{{b}^{2} + \left(c \cdot \left(a \cdot -3\right) + \left(\color{blue}{\left(-c \cdot \left(3 \cdot a\right)\right)} + \left(3 \cdot a\right) \cdot c\right)\right)}}{3 \cdot a} \]
      14. distribute-rgt-neg-in72.9%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{{b}^{2} + \left(c \cdot \left(a \cdot -3\right) + \left(c \cdot \left(-\color{blue}{a \cdot 3}\right) + \left(3 \cdot a\right) \cdot c\right)\right)}}{3 \cdot a} \]
      16. distribute-rgt-neg-in72.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{-\color{blue}{a \cdot \left(3 \cdot c\right)}} - b}{3 \cdot a} \]
      11. distribute-rgt-neg-in70.4%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{{\left({\left(a \cdot \left(-3 \cdot c\right)\right)}^{0.25}\right)}^{2}} - b}{3 \cdot a} \]
    9. Taylor expanded in a around 0 42.7%

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

        \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot \left({\left(e^{0.25 \cdot \left(\log a + \log \left(-3 \cdot c\right)\right)}\right)}^{2} - b\right)}{a}} \]
      2. remove-double-neg42.7%

        \[\leadsto \frac{0.3333333333333333 \cdot \left({\left(e^{0.25 \cdot \left(\log a + \log \left(-3 \cdot c\right)\right)}\right)}^{2} - b\right)}{\color{blue}{-\left(-a\right)}} \]
      3. neg-mul-142.7%

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

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

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

    if 1.05000000000000002e-106 < b

    1. Initial program 16.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 89.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.05 \cdot 10^{-76}:\\ \;\;\;\;\frac{\left(1.5 \cdot \frac{a}{\frac{b}{c}} - b\right) - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 1.05 \cdot 10^{-106}:\\ \;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(\sqrt{a \cdot \left(c \cdot -3\right)} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 3: 80.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{-74}:\\
\;\;\;\;\frac{\left(1.5 \cdot \frac{a}{\frac{b}{c}} - b\right) - b}{3 \cdot a}\\

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

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


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

    1. Initial program 73.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. flip--38.7%

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left({b}^{2} \cdot \color{blue}{{b}^{2}} - \left(\left(3 \cdot a\right) \cdot c\right) \cdot \left(\left(3 \cdot a\right) \cdot c\right)\right) \cdot \frac{1}{b \cdot b + \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
      5. pow-prod-up38.7%

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left({b}^{4} - \color{blue}{{\left(\left(3 \cdot a\right) \cdot c\right)}^{2}}\right) \cdot \frac{1}{b \cdot b + \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
      8. associate-*l*38.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(-1 \cdot b + 1.5 \cdot \frac{a \cdot c}{b}\right)}}{3 \cdot a} \]
    10. Step-by-step derivation
      1. +-commutative76.9%

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

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

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

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

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

    if -3.99999999999999983e-74 < b < 1.4500000000000001e-104

    1. Initial program 73.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 0 70.4%

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

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

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

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

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

    if 1.4500000000000001e-104 < b

    1. Initial program 16.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 89.3%

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

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

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

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

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

Alternative 4: 80.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.5 \cdot 10^{-75}:\\
\;\;\;\;\frac{\left(1.5 \cdot \frac{a}{\frac{b}{c}} - b\right) - b}{3 \cdot a}\\

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

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


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

    1. Initial program 73.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. flip--38.7%

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left({b}^{2} \cdot \color{blue}{{b}^{2}} - \left(\left(3 \cdot a\right) \cdot c\right) \cdot \left(\left(3 \cdot a\right) \cdot c\right)\right) \cdot \frac{1}{b \cdot b + \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
      5. pow-prod-up38.7%

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left({b}^{4} - \color{blue}{{\left(\left(3 \cdot a\right) \cdot c\right)}^{2}}\right) \cdot \frac{1}{b \cdot b + \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
      8. associate-*l*38.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(-1 \cdot b + 1.5 \cdot \frac{a \cdot c}{b}\right)}}{3 \cdot a} \]
    10. Step-by-step derivation
      1. +-commutative76.9%

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

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

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

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

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

    if -4.5000000000000003e-75 < b < 1.45e-108

    1. Initial program 73.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. prod-diff72.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{{b}^{2} + \left(c \cdot \left(a \cdot -3\right) + \left(\color{blue}{\left(-c \cdot \left(3 \cdot a\right)\right)} + \left(3 \cdot a\right) \cdot c\right)\right)}}{3 \cdot a} \]
      14. distribute-rgt-neg-in72.9%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{{b}^{2} + \left(c \cdot \left(a \cdot -3\right) + \left(c \cdot \left(-\color{blue}{a \cdot 3}\right) + \left(3 \cdot a\right) \cdot c\right)\right)}}{3 \cdot a} \]
      16. distribute-rgt-neg-in72.9%

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

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

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

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

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

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

        \[\leadsto 0.3333333333333333 \cdot \frac{\color{blue}{\sqrt{-6 \cdot \left(a \cdot c\right) + 3 \cdot \left(a \cdot c\right)}}}{a} \]
      3. distribute-rgt-out69.4%

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

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

        \[\leadsto 0.3333333333333333 \cdot \frac{\sqrt{\color{blue}{-3 \cdot \left(a \cdot c\right)}}}{a} \]
      6. metadata-eval69.4%

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

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

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

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

        \[\leadsto 0.3333333333333333 \cdot \frac{\sqrt{-\color{blue}{a \cdot \left(3 \cdot c\right)}}}{a} \]
      11. distribute-rgt-neg-in69.5%

        \[\leadsto 0.3333333333333333 \cdot \frac{\sqrt{\color{blue}{a \cdot \left(-3 \cdot c\right)}}}{a} \]
      12. distribute-lft-neg-in69.5%

        \[\leadsto 0.3333333333333333 \cdot \frac{\sqrt{a \cdot \color{blue}{\left(\left(-3\right) \cdot c\right)}}}{a} \]
      13. metadata-eval69.5%

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

        \[\leadsto 0.3333333333333333 \cdot \frac{\sqrt{a \cdot \color{blue}{\left(c \cdot -3\right)}}}{a} \]
    6. Simplified69.5%

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

    if 1.45e-108 < b

    1. Initial program 16.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 89.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.5 \cdot 10^{-75}:\\ \;\;\;\;\frac{\left(1.5 \cdot \frac{a}{\frac{b}{c}} - b\right) - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 1.45 \cdot 10^{-108}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 5: 80.2% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 2.3 \cdot 10^{-95}:\\
\;\;\;\;\sqrt{c \cdot \left(a \cdot -3\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 < -6.5e-76

    1. Initial program 73.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. flip--38.7%

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left({b}^{2} \cdot \color{blue}{{b}^{2}} - \left(\left(3 \cdot a\right) \cdot c\right) \cdot \left(\left(3 \cdot a\right) \cdot c\right)\right) \cdot \frac{1}{b \cdot b + \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
      5. pow-prod-up38.7%

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left({b}^{4} - \color{blue}{{\left(\left(3 \cdot a\right) \cdot c\right)}^{2}}\right) \cdot \frac{1}{b \cdot b + \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
      8. associate-*l*38.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(-1 \cdot b + 1.5 \cdot \frac{a \cdot c}{b}\right)}}{3 \cdot a} \]
    10. Step-by-step derivation
      1. +-commutative76.9%

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

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

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

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

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

    if -6.5e-76 < b < 2.29999999999999999e-95

    1. Initial program 71.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. prod-diff71.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{0.3333333333333333}}{a} \cdot \sqrt{-6 \cdot \left(a \cdot c\right) + 3 \cdot \left(a \cdot c\right)} \]
      4. distribute-rgt-out68.3%

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

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

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

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

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

    if 2.29999999999999999e-95 < b

    1. Initial program 14.8%

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. *-commutative90.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.5 \cdot 10^{-76}:\\ \;\;\;\;\frac{\left(1.5 \cdot \frac{a}{\frac{b}{c}} - b\right) - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 2.3 \cdot 10^{-95}:\\ \;\;\;\;\sqrt{c \cdot \left(a \cdot -3\right)} \cdot \frac{0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 6: 68.1% accurate, 6.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(1.5 \cdot \frac{a}{\frac{b}{c}} - b\right) - b}{3 \cdot a}\\

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


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

    1. Initial program 74.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. flip--41.8%

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left({b}^{2} \cdot \color{blue}{{b}^{2}} - \left(\left(3 \cdot a\right) \cdot c\right) \cdot \left(\left(3 \cdot a\right) \cdot c\right)\right) \cdot \frac{1}{b \cdot b + \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
      5. pow-prod-up41.8%

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left({b}^{4} - \color{blue}{{\left(\left(3 \cdot a\right) \cdot c\right)}^{2}}\right) \cdot \frac{1}{b \cdot b + \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
      8. associate-*l*41.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \left(1.5 \cdot \frac{a \cdot c}{b} + \color{blue}{\left(-b\right)}\right)}{3 \cdot a} \]
      3. unsub-neg62.1%

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 27.6%

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. *-commutative72.6%

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

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

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

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

Alternative 7: 68.1% accurate, 8.9× speedup?

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

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

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


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

    1. Initial program 74.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 65.9%

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

    if -4.999999999999985e-310 < b

    1. Initial program 27.6%

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. *-commutative72.6%

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

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

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

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

Alternative 8: 67.9% accurate, 12.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 3.1 \cdot 10^{-283}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 3.1e-283) (/ (* b -2.0) (* 3.0 a)) (/ (* c -0.5) b)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 3.1e-283) {
		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 <= 3.1d-283) 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 <= 3.1e-283) {
		tmp = (b * -2.0) / (3.0 * a);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 3.1e-283:
		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 <= 3.1e-283)
		tmp = Float64(Float64(b * -2.0) / Float64(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 <= 3.1e-283)
		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, 3.1e-283], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 73.5%

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

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

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

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

    if 3.10000000000000004e-283 < b

    1. Initial program 26.8%

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. *-commutative74.8%

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

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

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

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

Alternative 9: 67.9% accurate, 16.4× speedup?

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

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

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


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

    1. Initial program 73.5%

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

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

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

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

    if 3.10000000000000004e-283 < b

    1. Initial program 26.8%

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. *-commutative74.8%

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

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

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

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

Alternative 10: 34.3% accurate, 23.2× speedup?

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

\\
-0.6666666666666666 \cdot \frac{b}{a}
\end{array}
Derivation
  1. Initial program 50.7%

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

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

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

    \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
  5. Final simplification34.0%

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

Reproduce

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