Cubic critical

Percentage Accurate: 52.0% → 84.6%
Time: 20.6s
Alternatives: 14
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 14 alternatives:

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

Initial Program: 52.0% accurate, 1.0× speedup?

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

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

Alternative 1: 84.6% accurate, 0.9× speedup?

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

\mathbf{elif}\;b \leq 5.4 \cdot 10^{-16}:\\
\;\;\;\;\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 < -4.0999999999999999e108

    1. Initial program 52.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{a}} \]
      2. *-commutative88.9%

        \[\leadsto \color{blue}{\frac{c}{b} \cdot 0.5} + -0.6666666666666666 \cdot \frac{b}{a} \]
      3. fma-define88.9%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{c}{b}, 0.5, \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}}\right) \]
    7. Applied egg-rr89.1%

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

    if -4.0999999999999999e108 < b < 5.39999999999999999e-16

    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

    if 5.39999999999999999e-16 < b

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

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

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

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -4.3 \cdot 10^{+106}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{b}, 0.5, \frac{-0.6666666666666666}{\frac{a}{b}}\right)\\ \mathbf{elif}\;b \leq 6.2 \cdot 10^{-16}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\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 -4.3e+106)
   (fma (/ c b) 0.5 (/ -0.6666666666666666 (/ a b)))
   (if (<= b 6.2e-16)
     (/ (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) (* a 3.0))
     (/ (* c -0.5) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -4.3e+106) {
		tmp = fma((c / b), 0.5, (-0.6666666666666666 / (a / b)));
	} else if (b <= 6.2e-16) {
		tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -4.3e+106)
		tmp = fma(Float64(c / b), 0.5, Float64(-0.6666666666666666 / Float64(a / b)));
	elseif (b <= 6.2e-16)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(c * a)))) - b) / Float64(a * 3.0));
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -4.3e+106], N[(N[(c / b), $MachinePrecision] * 0.5 + N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.2e-16], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(c * a), $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 -4.3 \cdot 10^{+106}:\\
\;\;\;\;\mathsf{fma}\left(\frac{c}{b}, 0.5, \frac{-0.6666666666666666}{\frac{a}{b}}\right)\\

\mathbf{elif}\;b \leq 6.2 \cdot 10^{-16}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\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 < -4.3e106

    1. Initial program 52.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{a}} \]
      2. *-commutative88.9%

        \[\leadsto \color{blue}{\frac{c}{b} \cdot 0.5} + -0.6666666666666666 \cdot \frac{b}{a} \]
      3. fma-define88.9%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{c}{b}, 0.5, \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}}\right) \]
    7. Applied egg-rr89.1%

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

    if -4.3e106 < b < 6.2000000000000002e-16

    1. Initial program 78.4%

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

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

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

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

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

    if 6.2000000000000002e-16 < b

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.3 \cdot 10^{+106}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{b}, 0.5, \frac{-0.6666666666666666}{\frac{a}{b}}\right)\\ \mathbf{elif}\;b \leq 6.2 \cdot 10^{-16}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 79.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 69.5%

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

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

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

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

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

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

        \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{a}} \]
      2. *-commutative83.7%

        \[\leadsto \color{blue}{\frac{c}{b} \cdot 0.5} + -0.6666666666666666 \cdot \frac{b}{a} \]
      3. fma-define83.7%

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

        \[\leadsto \mathsf{fma}\left(\frac{c}{b}, 0.5, -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}}\right) \]
      5. un-div-inv83.8%

        \[\leadsto \mathsf{fma}\left(\frac{c}{b}, 0.5, \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}}\right) \]
    7. Applied egg-rr83.8%

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

    if -4.80000000000000018e-25 < b < 5.39999999999999999e-16

    1. Initial program 75.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(b - \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{1}{-\color{blue}{a \cdot 3}} \]
      18. distribute-rgt-neg-in64.6%

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

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

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

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

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

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

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

    if 5.39999999999999999e-16 < b

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.8 \cdot 10^{-25}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{b}, 0.5, \frac{-0.6666666666666666}{\frac{a}{b}}\right)\\ \mathbf{elif}\;b \leq 5.4 \cdot 10^{-16}:\\ \;\;\;\;\frac{-0.3333333333333333}{a} \cdot \left(b - \sqrt{a \cdot \left(c \cdot -3\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 79.0% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 5.4 \cdot 10^{-16}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \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 < -5.59999999999999976e-25

    1. Initial program 69.5%

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

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

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

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

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

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

        \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{a}} \]
      2. *-commutative83.7%

        \[\leadsto \color{blue}{\frac{c}{b} \cdot 0.5} + -0.6666666666666666 \cdot \frac{b}{a} \]
      3. fma-define83.7%

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

        \[\leadsto \mathsf{fma}\left(\frac{c}{b}, 0.5, -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}}\right) \]
      5. un-div-inv83.8%

        \[\leadsto \mathsf{fma}\left(\frac{c}{b}, 0.5, \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}}\right) \]
    7. Applied egg-rr83.8%

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

    if -5.59999999999999976e-25 < b < 5.39999999999999999e-16

    1. Initial program 75.1%

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

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

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

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

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

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

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

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

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

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

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

    if 5.39999999999999999e-16 < b

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 79.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -7.6 \cdot 10^{-25}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, -2, \left(c \cdot \frac{a}{b}\right) \cdot 1.5\right)}{a \cdot 3}\\ \mathbf{elif}\;b \leq 5.4 \cdot 10^{-16}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \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 -7.6e-25)
   (/ (fma b -2.0 (* (* c (/ a b)) 1.5)) (* a 3.0))
   (if (<= b 5.4e-16)
     (/ (- (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 <= -7.6e-25) {
		tmp = fma(b, -2.0, ((c * (a / b)) * 1.5)) / (a * 3.0);
	} else if (b <= 5.4e-16) {
		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 <= -7.6e-25)
		tmp = Float64(fma(b, -2.0, Float64(Float64(c * Float64(a / b)) * 1.5)) / Float64(a * 3.0));
	elseif (b <= 5.4e-16)
		tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -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, -7.6e-25], N[(N[(b * -2.0 + N[(N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.4e-16], N[(N[(N[Sqrt[N[(a * N[(c * -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 -7.6 \cdot 10^{-25}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \left(c \cdot \frac{a}{b}\right) \cdot 1.5\right)}{a \cdot 3}\\

\mathbf{elif}\;b \leq 5.4 \cdot 10^{-16}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \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 < -7.5999999999999996e-25

    1. Initial program 69.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.5999999999999996e-25 < b < 5.39999999999999999e-16

    1. Initial program 75.1%

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

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

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

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

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

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

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

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

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

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

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

    if 5.39999999999999999e-16 < b

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 68.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b} + -0.6666666666666666 \cdot \frac{b}{a}} \]
      2. *-commutative57.6%

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

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

        \[\leadsto \mathsf{fma}\left(\frac{c}{b}, 0.5, -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}}\right) \]
      5. un-div-inv57.7%

        \[\leadsto \mathsf{fma}\left(\frac{c}{b}, 0.5, \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}}\right) \]
    7. Applied egg-rr57.7%

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

    if -9.999999999999969e-311 < b

    1. Initial program 36.5%

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

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

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

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

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

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

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

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

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

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

Alternative 7: 67.9% accurate, 7.2× speedup?

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

\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 76.5%

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

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

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

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

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

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

    if -9.999999999999969e-311 < b

    1. Initial program 36.5%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 42.8% accurate, 11.6× speedup?

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

    1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    9. Applied egg-rr36.0%

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

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

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

    if 7.0000000000000002e72 < b

    1. Initial program 19.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.3333333333333333}{\frac{-2 \cdot b}{\color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)} \cdot c}} \]
      4. rem-square-sqrt28.5%

        \[\leadsto \frac{0.3333333333333333}{\frac{-2 \cdot b}{\color{blue}{-3} \cdot c}} \]
      5. times-frac28.5%

        \[\leadsto \frac{0.3333333333333333}{\color{blue}{\frac{-2}{-3} \cdot \frac{b}{c}}} \]
      6. metadata-eval28.5%

        \[\leadsto \frac{0.3333333333333333}{\color{blue}{0.6666666666666666} \cdot \frac{b}{c}} \]
    10. Simplified28.5%

      \[\leadsto \frac{0.3333333333333333}{\color{blue}{0.6666666666666666 \cdot \frac{b}{c}}} \]
    11. Taylor expanded in b around 0 28.5%

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{0.5}{b}} \]
    13. Simplified28.5%

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

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

Alternative 9: 42.8% accurate, 11.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 5.1 \cdot 10^{+72}:\\ \;\;\;\;\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+72) (/ -0.6666666666666666 (/ a b)) (* c (/ 0.5 b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 5.1e+72) {
		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+72) 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+72) {
		tmp = -0.6666666666666666 / (a / b);
	} else {
		tmp = c * (0.5 / b);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 5.1e+72:
		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+72)
		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+72)
		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+72], 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^{+72}:\\
\;\;\;\;\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.09999999999999977e72

    1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    9. Applied egg-rr36.0%

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

    if 5.09999999999999977e72 < b

    1. Initial program 19.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.3333333333333333}{\frac{-2 \cdot b}{\color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)} \cdot c}} \]
      4. rem-square-sqrt28.5%

        \[\leadsto \frac{0.3333333333333333}{\frac{-2 \cdot b}{\color{blue}{-3} \cdot c}} \]
      5. times-frac28.5%

        \[\leadsto \frac{0.3333333333333333}{\color{blue}{\frac{-2}{-3} \cdot \frac{b}{c}}} \]
      6. metadata-eval28.5%

        \[\leadsto \frac{0.3333333333333333}{\color{blue}{0.6666666666666666} \cdot \frac{b}{c}} \]
    10. Simplified28.5%

      \[\leadsto \frac{0.3333333333333333}{\color{blue}{0.6666666666666666 \cdot \frac{b}{c}}} \]
    11. Taylor expanded in b around 0 28.5%

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{0.5}{b}} \]
    13. Simplified28.5%

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

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

Alternative 10: 42.8% accurate, 11.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 5.09999999999999977e72

    1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    9. Applied egg-rr36.0%

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

    if 5.09999999999999977e72 < b

    1. Initial program 19.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.3333333333333333}{\frac{-2 \cdot b}{\color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)} \cdot c}} \]
      4. rem-square-sqrt28.5%

        \[\leadsto \frac{0.3333333333333333}{\frac{-2 \cdot b}{\color{blue}{-3} \cdot c}} \]
      5. times-frac28.5%

        \[\leadsto \frac{0.3333333333333333}{\color{blue}{\frac{-2}{-3} \cdot \frac{b}{c}}} \]
      6. metadata-eval28.5%

        \[\leadsto \frac{0.3333333333333333}{\color{blue}{0.6666666666666666} \cdot \frac{b}{c}} \]
    10. Simplified28.5%

      \[\leadsto \frac{0.3333333333333333}{\color{blue}{0.6666666666666666 \cdot \frac{b}{c}}} \]
    11. Step-by-step derivation
      1. div-inv28.5%

        \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{1}{0.6666666666666666 \cdot \frac{b}{c}}} \]
      2. associate-*r/28.5%

        \[\leadsto 0.3333333333333333 \cdot \frac{1}{\color{blue}{\frac{0.6666666666666666 \cdot b}{c}}} \]
    12. Applied egg-rr28.5%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{1}{\frac{0.6666666666666666 \cdot b}{c}}} \]
    13. Step-by-step derivation
      1. associate-*r/28.5%

        \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot 1}{\frac{0.6666666666666666 \cdot b}{c}}} \]
      2. metadata-eval28.5%

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

        \[\leadsto \frac{0.3333333333333333}{\color{blue}{0.6666666666666666 \cdot \frac{b}{c}}} \]
      4. associate-/r*28.5%

        \[\leadsto \color{blue}{\frac{\frac{0.3333333333333333}{0.6666666666666666}}{\frac{b}{c}}} \]
      5. metadata-eval28.5%

        \[\leadsto \frac{\color{blue}{0.5}}{\frac{b}{c}} \]
    14. Simplified28.5%

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

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

Alternative 11: 42.8% accurate, 11.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 5.19999999999999963e72

    1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    9. Applied egg-rr36.0%

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

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

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

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

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

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

        \[\leadsto \frac{b}{\color{blue}{a \cdot \frac{1}{-0.6666666666666666}}} \]
      5. metadata-eval36.0%

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    13. Applied egg-rr36.0%

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

    if 5.19999999999999963e72 < b

    1. Initial program 19.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.3333333333333333}{\frac{-2 \cdot b}{\color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)} \cdot c}} \]
      4. rem-square-sqrt28.5%

        \[\leadsto \frac{0.3333333333333333}{\frac{-2 \cdot b}{\color{blue}{-3} \cdot c}} \]
      5. times-frac28.5%

        \[\leadsto \frac{0.3333333333333333}{\color{blue}{\frac{-2}{-3} \cdot \frac{b}{c}}} \]
      6. metadata-eval28.5%

        \[\leadsto \frac{0.3333333333333333}{\color{blue}{0.6666666666666666} \cdot \frac{b}{c}} \]
    10. Simplified28.5%

      \[\leadsto \frac{0.3333333333333333}{\color{blue}{0.6666666666666666 \cdot \frac{b}{c}}} \]
    11. Step-by-step derivation
      1. div-inv28.5%

        \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{1}{0.6666666666666666 \cdot \frac{b}{c}}} \]
      2. associate-*r/28.5%

        \[\leadsto 0.3333333333333333 \cdot \frac{1}{\color{blue}{\frac{0.6666666666666666 \cdot b}{c}}} \]
    12. Applied egg-rr28.5%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{1}{\frac{0.6666666666666666 \cdot b}{c}}} \]
    13. Step-by-step derivation
      1. associate-*r/28.5%

        \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot 1}{\frac{0.6666666666666666 \cdot b}{c}}} \]
      2. metadata-eval28.5%

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

        \[\leadsto \frac{0.3333333333333333}{\color{blue}{0.6666666666666666 \cdot \frac{b}{c}}} \]
      4. associate-/r*28.5%

        \[\leadsto \color{blue}{\frac{\frac{0.3333333333333333}{0.6666666666666666}}{\frac{b}{c}}} \]
      5. metadata-eval28.5%

        \[\leadsto \frac{\color{blue}{0.5}}{\frac{b}{c}} \]
    14. Simplified28.5%

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

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

Alternative 12: 67.8% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    9. Applied egg-rr57.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}} \]
      4. div-inv57.1%

        \[\leadsto \frac{b}{\color{blue}{a \cdot \frac{1}{-0.6666666666666666}}} \]
      5. metadata-eval57.1%

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    13. Applied egg-rr57.1%

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

    if -9.999999999999969e-311 < b

    1. Initial program 36.5%

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

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

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

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

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

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

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

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

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

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

Alternative 13: 2.5% 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 54.5%

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

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

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
  4. Add Preprocessing
  5. Applied egg-rr31.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \frac{0.6666666666666666}{a}} \]
  10. Simplified3.0%

    \[\leadsto \color{blue}{b \cdot \frac{0.6666666666666666}{a}} \]
  11. Final simplification3.0%

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

Alternative 14: 10.8% accurate, 23.2× speedup?

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

\\
c \cdot \frac{0.5}{b}
\end{array}
Derivation
  1. Initial program 54.5%

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

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

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
  4. Add Preprocessing
  5. Applied egg-rr31.1%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{0.3333333333333333}{\frac{-2 \cdot b}{\color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)} \cdot c}} \]
    4. rem-square-sqrt9.9%

      \[\leadsto \frac{0.3333333333333333}{\frac{-2 \cdot b}{\color{blue}{-3} \cdot c}} \]
    5. times-frac9.9%

      \[\leadsto \frac{0.3333333333333333}{\color{blue}{\frac{-2}{-3} \cdot \frac{b}{c}}} \]
    6. metadata-eval9.9%

      \[\leadsto \frac{0.3333333333333333}{\color{blue}{0.6666666666666666} \cdot \frac{b}{c}} \]
  10. Simplified9.9%

    \[\leadsto \frac{0.3333333333333333}{\color{blue}{0.6666666666666666 \cdot \frac{b}{c}}} \]
  11. Taylor expanded in b around 0 9.9%

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

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

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

      \[\leadsto \color{blue}{c \cdot \frac{0.5}{b}} \]
  13. Simplified9.9%

    \[\leadsto \color{blue}{c \cdot \frac{0.5}{b}} \]
  14. Final simplification9.9%

    \[\leadsto c \cdot \frac{0.5}{b} \]
  15. Add Preprocessing

Reproduce

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