Cubic critical

Percentage Accurate: 51.6% → 85.3%
Time: 19.5s
Alternatives: 16
Speedup: 11.6×

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 16 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.6% 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, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+76}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{1.5 \cdot a}{\frac{b}{c}}\right)}{a \cdot 3}\\ \mathbf{elif}\;b \leq 8 \cdot 10^{-43}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1e+76)
   (/ (fma b -2.0 (/ (* 1.5 a) (/ b c))) (* a 3.0))
   (if (<= b 8e-43)
     (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
     (/ (* c -0.5) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e+76) {
		tmp = fma(b, -2.0, ((1.5 * a) / (b / c))) / (a * 3.0);
	} else if (b <= 8e-43) {
		tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -1e+76)
		tmp = Float64(fma(b, -2.0, Float64(Float64(1.5 * a) / Float64(b / c))) / Float64(a * 3.0));
	elseif (b <= 8e-43)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0));
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -1e+76], N[(N[(b * -2.0 + N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8e-43], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{+76}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{1.5 \cdot a}{\frac{b}{c}}\right)}{a \cdot 3}\\

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

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


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

    1. Initial program 62.1%

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

      \[\leadsto \frac{\color{blue}{-2 \cdot b + 1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a} \]
    4. Step-by-step derivation
      1. *-commutative88.0%

        \[\leadsto \frac{\color{blue}{b \cdot -2} + 1.5 \cdot \frac{a \cdot c}{b}}{3 \cdot a} \]
      2. fma-def88.0%

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

        \[\leadsto \frac{\mathsf{fma}\left(b, -2, 1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}\right)}{3 \cdot a} \]
      4. associate-*r/95.6%

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

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

    if -1e76 < b < 8.00000000000000062e-43

    1. Initial program 88.6%

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

    if 8.00000000000000062e-43 < b

    1. Initial program 15.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+76}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{1.5 \cdot a}{\frac{b}{c}}\right)}{a \cdot 3}\\ \mathbf{elif}\;b \leq 8 \cdot 10^{-43}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 80.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.9 \cdot 10^{-127}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{1.5 \cdot a}{\frac{b}{c}}\right)}{a \cdot 3}\\ \mathbf{elif}\;b \leq 10^{-42}:\\ \;\;\;\;\left(\sqrt{c \cdot \left(a \cdot -3\right)} - b\right) \cdot \frac{-1}{a \cdot -3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2.9e-127)
   (/ (fma b -2.0 (/ (* 1.5 a) (/ b c))) (* a 3.0))
   (if (<= b 1e-42)
     (* (- (sqrt (* c (* a -3.0))) b) (/ -1.0 (* a -3.0)))
     (/ (* c -0.5) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.9e-127) {
		tmp = fma(b, -2.0, ((1.5 * a) / (b / c))) / (a * 3.0);
	} else if (b <= 1e-42) {
		tmp = (sqrt((c * (a * -3.0))) - b) * (-1.0 / (a * -3.0));
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -2.9e-127)
		tmp = Float64(fma(b, -2.0, Float64(Float64(1.5 * a) / Float64(b / c))) / Float64(a * 3.0));
	elseif (b <= 1e-42)
		tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) * Float64(-1.0 / Float64(a * -3.0)));
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -2.9e-127], N[(N[(b * -2.0 + N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1e-42], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(-1.0 / N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.9 \cdot 10^{-127}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{1.5 \cdot a}{\frac{b}{c}}\right)}{a \cdot 3}\\

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

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


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

    1. Initial program 74.3%

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

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

        \[\leadsto \frac{\color{blue}{b \cdot -2} + 1.5 \cdot \frac{a \cdot c}{b}}{3 \cdot a} \]
      2. fma-def82.3%

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

        \[\leadsto \frac{\mathsf{fma}\left(b, -2, 1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}\right)}{3 \cdot a} \]
      4. associate-*r/87.4%

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

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

    if -2.9e-127 < b < 1.00000000000000004e-42

    1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000004e-42 < b

    1. Initial program 15.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.9 \cdot 10^{-127}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{1.5 \cdot a}{\frac{b}{c}}\right)}{a \cdot 3}\\ \mathbf{elif}\;b \leq 10^{-42}:\\ \;\;\;\;\left(\sqrt{c \cdot \left(a \cdot -3\right)} - b\right) \cdot \frac{-1}{a \cdot -3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 79.9% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 5.6 \cdot 10^{-41}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \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 < -2.9e-127

    1. Initial program 74.3%

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

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

    if -2.9e-127 < b < 5.6000000000000003e-41

    1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.6000000000000003e-41 < b

    1. Initial program 15.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.9 \cdot 10^{-127}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 5.6 \cdot 10^{-41}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 80.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.9 \cdot 10^{-127}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 1.66 \cdot 10^{-35}:\\ \;\;\;\;\left(b - \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2.9e-127)
   (+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
   (if (<= b 1.66e-35)
     (* (- b (sqrt (* c (* a -3.0)))) (/ -0.3333333333333333 a))
     (/ (* c -0.5) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.9e-127) {
		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
	} else if (b <= 1.66e-35) {
		tmp = (b - 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 <= (-2.9d-127)) then
        tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
    else if (b <= 1.66d-35) then
        tmp = (b - 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 <= -2.9e-127) {
		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
	} else if (b <= 1.66e-35) {
		tmp = (b - 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 <= -2.9e-127:
		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b))
	elif b <= 1.66e-35:
		tmp = (b - 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 <= -2.9e-127)
		tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b)));
	elseif (b <= 1.66e-35)
		tmp = Float64(Float64(b - 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 <= -2.9e-127)
		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
	elseif (b <= 1.66e-35)
		tmp = (b - 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, -2.9e-127], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.66e-35], N[(N[(b - N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 74.3%

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

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

    if -2.9e-127 < b < 1.65999999999999999e-35

    1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.65999999999999999e-35 < b

    1. Initial program 15.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.9 \cdot 10^{-127}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 1.66 \cdot 10^{-35}:\\ \;\;\;\;\left(b - \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 80.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 74.3%

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

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

    if -2.9e-127 < b < 5.20000000000000009e-35

    1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

    if 5.20000000000000009e-35 < b

    1. Initial program 15.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.9 \cdot 10^{-127}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 5.2 \cdot 10^{-35}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 80.2% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 74.3%

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

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

    if -3.79999999999999985e-129 < b < 1.00000000000000004e-42

    1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000004e-42 < b

    1. Initial program 15.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.8 \cdot 10^{-129}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 10^{-42}:\\ \;\;\;\;\frac{\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}}{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 80.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.9 \cdot 10^{-127}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{1.5 \cdot a}{\frac{b}{c}}\right)}{a \cdot 3}\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{-42}:\\ \;\;\;\;\frac{\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}}{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2.9e-127)
   (/ (fma b -2.0 (/ (* 1.5 a) (/ b c))) (* a 3.0))
   (if (<= b 4.4e-42)
     (/ (/ (- (sqrt (* a (* c -3.0))) b) a) 3.0)
     (/ (* c -0.5) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.9e-127) {
		tmp = fma(b, -2.0, ((1.5 * a) / (b / c))) / (a * 3.0);
	} else if (b <= 4.4e-42) {
		tmp = ((sqrt((a * (c * -3.0))) - b) / a) / 3.0;
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -2.9e-127)
		tmp = Float64(fma(b, -2.0, Float64(Float64(1.5 * a) / Float64(b / c))) / Float64(a * 3.0));
	elseif (b <= 4.4e-42)
		tmp = Float64(Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / a) / 3.0);
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -2.9e-127], N[(N[(b * -2.0 + N[(N[(1.5 * a), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.4e-42], N[(N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision] / 3.0), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.9 \cdot 10^{-127}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{1.5 \cdot a}{\frac{b}{c}}\right)}{a \cdot 3}\\

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

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


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

    1. Initial program 74.3%

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

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

        \[\leadsto \frac{\color{blue}{b \cdot -2} + 1.5 \cdot \frac{a \cdot c}{b}}{3 \cdot a} \]
      2. fma-def82.3%

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

        \[\leadsto \frac{\mathsf{fma}\left(b, -2, 1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}\right)}{3 \cdot a} \]
      4. associate-*r/87.4%

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

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

    if -2.9e-127 < b < 4.4000000000000001e-42

    1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.4000000000000001e-42 < b

    1. Initial program 15.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.9 \cdot 10^{-127}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{1.5 \cdot a}{\frac{b}{c}}\right)}{a \cdot 3}\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{-42}:\\ \;\;\;\;\frac{\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}}{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 67.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, \frac{c \cdot 0.5}{b}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1e-310)
   (fma -0.6666666666666666 (/ b a) (/ (* c 0.5) b))
   (/ (* c -0.5) b)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e-310) {
		tmp = fma(-0.6666666666666666, (b / a), ((c * 0.5) / b));
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -1e-310)
		tmp = fma(-0.6666666666666666, Float64(b / a), Float64(Float64(c * 0.5) / b));
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -1e-310], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(N[(c * 0.5), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, \frac{c \cdot 0.5}{b}\right)\\

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


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

    1. Initial program 78.4%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)} \]
      2. associate-*r/68.2%

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

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

    if -9.999999999999969e-311 < b

    1. Initial program 33.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, \frac{c \cdot 0.5}{b}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 67.8% accurate, 7.2× speedup?

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

    1. Initial program 78.4%

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

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

    if -9.999999999999969e-311 < b

    1. Initial program 33.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1 \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} \]
  5. Add Preprocessing

Alternative 10: 67.6% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 78.9%

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

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

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

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

    if 5.1000000000000003e-245 < b

    1. Initial program 31.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 5.1 \cdot 10^{-245}:\\ \;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 67.6% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 78.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Add Preprocessing
    3. Applied egg-rr66.6%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot \frac{1}{a}}{--3}} \]
      3. un-div-inv66.5%

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

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

      \[\leadsto \color{blue}{\frac{-\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a}}{3}} \]
    8. Step-by-step derivation
      1. distribute-neg-frac66.5%

        \[\leadsto \frac{\color{blue}{\frac{-\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right)}{a}}}{3} \]
      2. sub-neg66.5%

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

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

        \[\leadsto \frac{\frac{\color{blue}{\left(-\left(-\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right)\right) + \left(-b\right)}}{a}}{3} \]
      5. remove-double-neg66.5%

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

        \[\leadsto \frac{\frac{\color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right) - b}}{a}}{3} \]
      7. associate-*r*66.4%

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

        \[\leadsto \frac{\frac{\mathsf{hypot}\left(b, \sqrt{\color{blue}{\left(a \cdot c\right)} \cdot -3}\right) - b}{a}}{3} \]
      9. rem-square-sqrt0.0%

        \[\leadsto \frac{\frac{\mathsf{hypot}\left(b, \sqrt{\left(a \cdot c\right) \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}\right) - b}{a}}{3} \]
      10. unpow20.0%

        \[\leadsto \frac{\frac{\mathsf{hypot}\left(b, \sqrt{\left(a \cdot c\right) \cdot \color{blue}{{\left(\sqrt{-3}\right)}^{2}}}\right) - b}{a}}{3} \]
      11. associate-*r*0.0%

        \[\leadsto \frac{\frac{\mathsf{hypot}\left(b, \sqrt{\color{blue}{a \cdot \left(c \cdot {\left(\sqrt{-3}\right)}^{2}\right)}}\right) - b}{a}}{3} \]
      12. unpow20.0%

        \[\leadsto \frac{\frac{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}\right)}\right) - b}{a}}{3} \]
      13. rem-square-sqrt66.5%

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

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

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

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

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

    if 5.1000000000000003e-245 < b

    1. Initial program 31.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 5.1 \cdot 10^{-245}:\\ \;\;\;\;\frac{\frac{b \cdot -2}{a}}{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 67.5% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 78.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    8. Step-by-step derivation
      1. associate-/r/66.3%

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

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

    if 5.1000000000000003e-245 < b

    1. Initial program 31.9%

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
      2. *-rgt-identity70.6%

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

        \[\leadsto \color{blue}{\frac{-0.5}{b} \cdot \frac{c}{1}} \]
      4. /-rgt-identity70.4%

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

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

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

Alternative 13: 67.5% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 78.9%

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

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

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

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

    if 5.1000000000000003e-245 < b

    1. Initial program 31.9%

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
      2. *-rgt-identity70.6%

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

        \[\leadsto \color{blue}{\frac{-0.5}{b} \cdot \frac{c}{1}} \]
      4. /-rgt-identity70.4%

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

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

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

Alternative 14: 67.5% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 78.9%

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

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

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

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

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

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

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

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

    if 5.1000000000000003e-245 < b

    1. Initial program 31.9%

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
      2. *-rgt-identity70.6%

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

        \[\leadsto \color{blue}{\frac{-0.5}{b} \cdot \frac{c}{1}} \]
      4. /-rgt-identity70.4%

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

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

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

Alternative 15: 67.6% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 78.9%

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

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

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

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

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

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

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

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

    if 5.1000000000000003e-245 < b

    1. Initial program 31.9%

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

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

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

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

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

Alternative 16: 35.0% accurate, 23.2× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
  7. Applied egg-rr35.5%

    \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
  8. Step-by-step derivation
    1. associate-/r/35.4%

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

    \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
  10. Final simplification35.4%

    \[\leadsto b \cdot \frac{-0.6666666666666666}{a} \]
  11. Add Preprocessing

Reproduce

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