Cubic critical

Percentage Accurate: 51.9% → 84.6%
Time: 15.4s
Alternatives: 11
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 11 alternatives:

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

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

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

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

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


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

    1. Initial program 53.9%

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

        \[\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-neg53.9%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified53.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. Applied egg-rr53.7%

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

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    9. Step-by-step derivation
      1. clear-num98.0%

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

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

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

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

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

    if -3e135 < b < 1.04999999999999999e-152

    1. Initial program 86.5%

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

    if 1.04999999999999999e-152 < b

    1. Initial program 22.9%

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

        \[\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-neg22.9%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified22.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 inf 82.7%

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

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

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

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

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

Alternative 2: 84.5% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 53.9%

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

        \[\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-neg53.9%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified53.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. Applied egg-rr53.7%

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

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    9. Step-by-step derivation
      1. clear-num98.0%

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

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

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

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

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

    if -5.00000000000000029e135 < b < 1.04999999999999999e-152

    1. Initial program 86.5%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Step-by-step derivation
      1. sqr-neg86.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-neg86.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*86.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified86.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

    if 1.04999999999999999e-152 < b

    1. Initial program 22.9%

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

        \[\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-neg22.9%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified22.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 inf 82.7%

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

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

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

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

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

Alternative 3: 78.8% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 1.05 \cdot 10^{-152}:\\
\;\;\;\;\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 < -8e4

    1. Initial program 69.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-neg69.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-neg69.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*69.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified69.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 90.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(b, -2, a \cdot \left(\frac{c}{b} \cdot 1.5\right)\right)}{a}}{3}} \]
    10. Taylor expanded in b around 0 94.2%

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

    if -8e4 < b < 1.04999999999999999e-152

    1. Initial program 81.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-neg81.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-neg81.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*80.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified80.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 68.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.04999999999999999e-152 < b

    1. Initial program 22.9%

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

        \[\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-neg22.9%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified22.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 inf 82.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -80000:\\ \;\;\;\;\frac{-2 \cdot \frac{b}{a} + 1.5 \cdot \frac{c}{b}}{3}\\ \mathbf{elif}\;b \leq 1.05 \cdot 10^{-152}:\\ \;\;\;\;\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: 67.9% accurate, 6.4× speedup?

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

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

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


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

    1. Initial program 74.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-neg74.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-neg74.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*74.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified74.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 68.6%

      \[\leadsto \frac{\color{blue}{-2 \cdot b + 1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a} \]
    6. Step-by-step derivation
      1. add-cube-cbrt67.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(b, -2, a \cdot \left(\frac{c}{b} \cdot 1.5\right)\right)}{a}}{3}} \]
    10. Taylor expanded in b around 0 71.3%

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

    if -4.999999999999985e-310 < b

    1. Initial program 31.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-neg31.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-neg31.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*31.1%

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

      \[\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 71.3%

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

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

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

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

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

Alternative 5: 67.9% accurate, 7.2× speedup?

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

    1. Initial program 74.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-neg74.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-neg74.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*74.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified74.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 71.2%

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

    if -4.999999999999985e-310 < b

    1. Initial program 31.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-neg31.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-neg31.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*31.1%

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

      \[\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 71.3%

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

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

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

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

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

Alternative 6: 42.8% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 67.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-neg67.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-neg67.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*67.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified67.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-rr63.0%

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

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

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

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

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

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

    if 1.22e61 < b

    1. Initial program 14.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-neg14.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-neg14.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*14.5%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified14.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 2.2%

      \[\leadsto \frac{\color{blue}{-2 \cdot b + 1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a} \]
    6. Taylor expanded in b around 0 35.8%

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

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

Alternative 7: 42.8% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 67.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-neg67.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-neg67.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*67.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified67.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 49.8%

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

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

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

    if 1.22e61 < b

    1. Initial program 14.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-neg14.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-neg14.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*14.5%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified14.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 2.2%

      \[\leadsto \frac{\color{blue}{-2 \cdot b + 1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a} \]
    6. Taylor expanded in b around 0 35.8%

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

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

Alternative 8: 42.9% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 67.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-neg67.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-neg67.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*67.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified67.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-rr63.0%

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

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

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

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

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

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

        \[\leadsto b \cdot \color{blue}{\frac{1}{\frac{a}{-0.6666666666666666}}} \]
      2. un-div-inv49.8%

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr49.9%

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

    if 1.22e61 < b

    1. Initial program 14.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-neg14.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-neg14.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*14.5%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified14.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 2.2%

      \[\leadsto \frac{\color{blue}{-2 \cdot b + 1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a} \]
    6. Taylor expanded in b around 0 35.8%

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

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

Alternative 9: 67.8% accurate, 11.6× speedup?

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

    1. Initial program 74.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-neg74.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-neg74.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*74.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified74.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-rr68.4%

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

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

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

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

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

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

        \[\leadsto b \cdot \color{blue}{\frac{1}{\frac{a}{-0.6666666666666666}}} \]
      2. un-div-inv70.7%

        \[\leadsto \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}} \]
      3. div-inv70.7%

        \[\leadsto \frac{b}{\color{blue}{a \cdot \frac{1}{-0.6666666666666666}}} \]
      4. metadata-eval70.7%

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr70.7%

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

    if 3.8999999999999999e-308 < b

    1. Initial program 31.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-neg31.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-neg31.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*31.1%

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

      \[\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 71.3%

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

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

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

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

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

Alternative 10: 67.8% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 74.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-neg74.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-neg74.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*74.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified74.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-rr68.4%

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

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

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

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

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

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

        \[\leadsto b \cdot \color{blue}{\frac{1}{\frac{a}{-0.6666666666666666}}} \]
      2. un-div-inv70.7%

        \[\leadsto \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}} \]
      3. div-inv70.7%

        \[\leadsto \frac{b}{\color{blue}{a \cdot \frac{1}{-0.6666666666666666}}} \]
      4. metadata-eval70.7%

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr70.7%

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

        \[\leadsto \color{blue}{\frac{\frac{b}{a}}{-1.5}} \]
    12. Simplified70.7%

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

    if -4.999999999999985e-310 < b

    1. Initial program 31.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-neg31.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-neg31.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*31.1%

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

      \[\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 71.3%

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

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

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

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

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

Alternative 11: 10.8% accurate, 23.2× speedup?

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

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

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

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

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

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

    \[\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.4%

    \[\leadsto \frac{\color{blue}{-2 \cdot b + 1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a} \]
  6. Taylor expanded in b around 0 12.3%

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

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

Reproduce

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