Cubic critical

Percentage Accurate: 53.0% → 84.4%
Time: 19.1s
Alternatives: 16
Speedup: 11.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 53.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.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\\ \mathbf{if}\;b \leq -1.6 \cdot 10^{+161}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 8.6 \cdot 10^{-130}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 15000000\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}{t\_0} - \frac{{b}^{2}}{t\_0}}{3 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (+ b (hypot b (sqrt (* c (* a -3.0)))))))
   (if (<= b -1.6e+161)
     (/ (* b -2.0) (* 3.0 a))
     (if (<= b 8.6e-130)
       (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
       (if (or (<= b 1100.0) (not (<= b 15000000.0)))
         (/ (* c -0.5) b)
         (/
          (- (/ (fma c (* a -3.0) (pow b 2.0)) t_0) (/ (pow b 2.0) t_0))
          (* 3.0 a)))))))
double code(double a, double b, double c) {
	double t_0 = b + hypot(b, sqrt((c * (a * -3.0))));
	double tmp;
	if (b <= -1.6e+161) {
		tmp = (b * -2.0) / (3.0 * a);
	} else if (b <= 8.6e-130) {
		tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
	} else if ((b <= 1100.0) || !(b <= 15000000.0)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = ((fma(c, (a * -3.0), pow(b, 2.0)) / t_0) - (pow(b, 2.0) / t_0)) / (3.0 * a);
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(b + hypot(b, sqrt(Float64(c * Float64(a * -3.0)))))
	tmp = 0.0
	if (b <= -1.6e+161)
		tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a));
	elseif (b <= 8.6e-130)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a));
	elseif ((b <= 1100.0) || !(b <= 15000000.0))
		tmp = Float64(Float64(c * -0.5) / b);
	else
		tmp = Float64(Float64(Float64(fma(c, Float64(a * -3.0), (b ^ 2.0)) / t_0) - Float64((b ^ 2.0) / t_0)) / Float64(3.0 * a));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(b + N[Sqrt[b ^ 2 + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.6e+161], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.6e-130], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1100.0], N[Not[LessEqual[b, 15000000.0]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(N[(N[(N[(c * N[(a * -3.0), $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] - N[(N[Power[b, 2.0], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\\
\mathbf{if}\;b \leq -1.6 \cdot 10^{+161}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\

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

\mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 15000000\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}{t\_0} - \frac{{b}^{2}}{t\_0}}{3 \cdot a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -1.60000000000000001e161

    1. Initial program 23.9%

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

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

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

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

    if -1.60000000000000001e161 < b < 8.60000000000000058e-130

    1. Initial program 86.3%

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

    if 8.60000000000000058e-130 < b < 1100 or 1.5e7 < b

    1. Initial program 18.6%

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

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

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

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

    if 1100 < b < 1.5e7

    1. Initial program 99.4%

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)} - \frac{{b}^{2}}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}}{3 \cdot a} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification87.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.6 \cdot 10^{+161}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 8.6 \cdot 10^{-130}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 15000000\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)} - \frac{{b}^{2}}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}{3 \cdot a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 79.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -6.2 \cdot 10^{-117}:\\ \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 8.6 \cdot 10^{-130} \lor \neg \left(b \leq 1100\right) \land b \leq 11000000:\\ \;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -6.2e-117)
   (+ (/ -0.6666666666666666 (/ a b)) (* 0.5 (/ c b)))
   (if (or (<= b 8.6e-130) (and (not (<= b 1100.0)) (<= b 11000000.0)))
     (* 0.3333333333333333 (/ (+ b (sqrt (* c (* a -3.0)))) a))
     (/ (* c -0.5) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -6.2e-117) {
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	} else if ((b <= 8.6e-130) || (!(b <= 1100.0) && (b <= 11000000.0))) {
		tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-6.2d-117)) then
        tmp = ((-0.6666666666666666d0) / (a / b)) + (0.5d0 * (c / b))
    else if ((b <= 8.6d-130) .or. (.not. (b <= 1100.0d0)) .and. (b <= 11000000.0d0)) then
        tmp = 0.3333333333333333d0 * ((b + sqrt((c * (a * (-3.0d0))))) / a)
    else
        tmp = (c * (-0.5d0)) / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -6.2e-117) {
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	} else if ((b <= 8.6e-130) || (!(b <= 1100.0) && (b <= 11000000.0))) {
		tmp = 0.3333333333333333 * ((b + Math.sqrt((c * (a * -3.0)))) / a);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -6.2e-117:
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b))
	elif (b <= 8.6e-130) or (not (b <= 1100.0) and (b <= 11000000.0)):
		tmp = 0.3333333333333333 * ((b + math.sqrt((c * (a * -3.0)))) / a)
	else:
		tmp = (c * -0.5) / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -6.2e-117)
		tmp = Float64(Float64(-0.6666666666666666 / Float64(a / b)) + Float64(0.5 * Float64(c / b)));
	elseif ((b <= 8.6e-130) || (!(b <= 1100.0) && (b <= 11000000.0)))
		tmp = Float64(0.3333333333333333 * Float64(Float64(b + sqrt(Float64(c * Float64(a * -3.0)))) / a));
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -6.2e-117)
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	elseif ((b <= 8.6e-130) || (~((b <= 1100.0)) && (b <= 11000000.0)))
		tmp = 0.3333333333333333 * ((b + sqrt((c * (a * -3.0)))) / a);
	else
		tmp = (c * -0.5) / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -6.2e-117], N[(N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 8.6e-130], And[N[Not[LessEqual[b, 1100.0]], $MachinePrecision], LessEqual[b, 11000000.0]]], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 8.6 \cdot 10^{-130} \lor \neg \left(b \leq 1100\right) \land b \leq 11000000:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\

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


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

    1. Initial program 64.1%

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

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

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} + 0.5 \cdot \frac{c}{b} \]
      2. un-div-inv87.2%

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

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

    if -6.20000000000000022e-117 < b < 8.60000000000000058e-130 or 1100 < b < 1.1e7

    1. Initial program 82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.60000000000000058e-130 < b < 1100 or 1.1e7 < b

    1. Initial program 18.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.2 \cdot 10^{-117}:\\ \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 8.6 \cdot 10^{-130} \lor \neg \left(b \leq 1100\right) \land b \leq 11000000:\\ \;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 79.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := b + \sqrt{c \cdot \left(a \cdot -3\right)}\\ \mathbf{if}\;b \leq -1.15 \cdot 10^{-110}:\\ \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 8.6 \cdot 10^{-130}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{t\_0}{a}\\ \mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 12000000\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \frac{0.3333333333333333}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (+ b (sqrt (* c (* a -3.0))))))
   (if (<= b -1.15e-110)
     (+ (/ -0.6666666666666666 (/ a b)) (* 0.5 (/ c b)))
     (if (<= b 8.6e-130)
       (* 0.3333333333333333 (/ t_0 a))
       (if (or (<= b 1100.0) (not (<= b 12000000.0)))
         (/ (* c -0.5) b)
         (* t_0 (/ 0.3333333333333333 a)))))))
double code(double a, double b, double c) {
	double t_0 = b + sqrt((c * (a * -3.0)));
	double tmp;
	if (b <= -1.15e-110) {
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	} else if (b <= 8.6e-130) {
		tmp = 0.3333333333333333 * (t_0 / a);
	} else if ((b <= 1100.0) || !(b <= 12000000.0)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = t_0 * (0.3333333333333333 / a);
	}
	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) :: t_0
    real(8) :: tmp
    t_0 = b + sqrt((c * (a * (-3.0d0))))
    if (b <= (-1.15d-110)) then
        tmp = ((-0.6666666666666666d0) / (a / b)) + (0.5d0 * (c / b))
    else if (b <= 8.6d-130) then
        tmp = 0.3333333333333333d0 * (t_0 / a)
    else if ((b <= 1100.0d0) .or. (.not. (b <= 12000000.0d0))) then
        tmp = (c * (-0.5d0)) / b
    else
        tmp = t_0 * (0.3333333333333333d0 / a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = b + Math.sqrt((c * (a * -3.0)));
	double tmp;
	if (b <= -1.15e-110) {
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	} else if (b <= 8.6e-130) {
		tmp = 0.3333333333333333 * (t_0 / a);
	} else if ((b <= 1100.0) || !(b <= 12000000.0)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = t_0 * (0.3333333333333333 / a);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = b + math.sqrt((c * (a * -3.0)))
	tmp = 0
	if b <= -1.15e-110:
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b))
	elif b <= 8.6e-130:
		tmp = 0.3333333333333333 * (t_0 / a)
	elif (b <= 1100.0) or not (b <= 12000000.0):
		tmp = (c * -0.5) / b
	else:
		tmp = t_0 * (0.3333333333333333 / a)
	return tmp
function code(a, b, c)
	t_0 = Float64(b + sqrt(Float64(c * Float64(a * -3.0))))
	tmp = 0.0
	if (b <= -1.15e-110)
		tmp = Float64(Float64(-0.6666666666666666 / Float64(a / b)) + Float64(0.5 * Float64(c / b)));
	elseif (b <= 8.6e-130)
		tmp = Float64(0.3333333333333333 * Float64(t_0 / a));
	elseif ((b <= 1100.0) || !(b <= 12000000.0))
		tmp = Float64(Float64(c * -0.5) / b);
	else
		tmp = Float64(t_0 * Float64(0.3333333333333333 / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = b + sqrt((c * (a * -3.0)));
	tmp = 0.0;
	if (b <= -1.15e-110)
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	elseif (b <= 8.6e-130)
		tmp = 0.3333333333333333 * (t_0 / a);
	elseif ((b <= 1100.0) || ~((b <= 12000000.0)))
		tmp = (c * -0.5) / b;
	else
		tmp = t_0 * (0.3333333333333333 / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(b + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.15e-110], N[(N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 8.6e-130], N[(0.3333333333333333 * N[(t$95$0 / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1100.0], N[Not[LessEqual[b, 12000000.0]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(t$95$0 * N[(0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := b + \sqrt{c \cdot \left(a \cdot -3\right)}\\
\mathbf{if}\;b \leq -1.15 \cdot 10^{-110}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\

\mathbf{elif}\;b \leq 8.6 \cdot 10^{-130}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{t\_0}{a}\\

\mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 12000000\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{0.3333333333333333}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -1.1500000000000001e-110

    1. Initial program 64.1%

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

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

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} + 0.5 \cdot \frac{c}{b} \]
      2. un-div-inv87.2%

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

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

    if -1.1500000000000001e-110 < b < 8.60000000000000058e-130

    1. Initial program 80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.60000000000000058e-130 < b < 1100 or 1.2e7 < b

    1. Initial program 18.6%

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

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

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

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

    if 1100 < b < 1.2e7

    1. Initial program 99.4%

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

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\left(-b\right) + \sqrt{-3 \cdot \left(a \cdot c\right)}}{3 \cdot a}\right)} - 1} \]
      3. div-inv2.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\left(\left(-b\right) + \sqrt{-3 \cdot \left(a \cdot c\right)}\right) \cdot \frac{1}{3 \cdot a}}\right)} - 1 \]
      4. add-sqr-sqrt0.0%

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

        \[\leadsto e^{\mathsf{log1p}\left(\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}\right)} - 1 \]
      6. sqr-neg2.5%

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

        \[\leadsto e^{\mathsf{log1p}\left(\left(\color{blue}{\sqrt{b} \cdot \sqrt{b}} + \sqrt{-3 \cdot \left(a \cdot c\right)}\right) \cdot \frac{1}{3 \cdot a}\right)} - 1 \]
      8. add-sqr-sqrt2.5%

        \[\leadsto e^{\mathsf{log1p}\left(\left(\color{blue}{b} + \sqrt{-3 \cdot \left(a \cdot c\right)}\right) \cdot \frac{1}{3 \cdot a}\right)} - 1 \]
      9. associate-*r*2.5%

        \[\leadsto e^{\mathsf{log1p}\left(\left(b + \sqrt{\color{blue}{\left(-3 \cdot a\right) \cdot c}}\right) \cdot \frac{1}{3 \cdot a}\right)} - 1 \]
      10. *-commutative2.5%

        \[\leadsto e^{\mathsf{log1p}\left(\left(b + \sqrt{\color{blue}{\left(a \cdot -3\right)} \cdot c}\right) \cdot \frac{1}{3 \cdot a}\right)} - 1 \]
      11. *-commutative2.5%

        \[\leadsto e^{\mathsf{log1p}\left(\left(b + \sqrt{\color{blue}{c \cdot \left(a \cdot -3\right)}}\right) \cdot \frac{1}{3 \cdot a}\right)} - 1 \]
      12. associate-/r*2.5%

        \[\leadsto e^{\mathsf{log1p}\left(\left(b + \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \color{blue}{\frac{\frac{1}{3}}{a}}\right)} - 1 \]
      13. metadata-eval2.5%

        \[\leadsto e^{\mathsf{log1p}\left(\left(b + \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{\color{blue}{0.3333333333333333}}{a}\right)} - 1 \]
    5. Applied egg-rr2.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(b + \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a}\right)} - 1} \]
    6. Step-by-step derivation
      1. expm1-def59.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(b + \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a}\right)\right)} \]
      2. expm1-log1p98.8%

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

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

      \[\leadsto \color{blue}{\frac{0.3333333333333333}{a} \cdot \left(b + \sqrt{c \cdot \left(a \cdot -3\right)}\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification85.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.15 \cdot 10^{-110}:\\ \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 8.6 \cdot 10^{-130}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{c \cdot \left(a \cdot -3\right)}}{a}\\ \mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 12000000\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;\left(b + \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 79.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.02 \cdot 10^{-96}:\\ \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 4.1 \cdot 10^{-132} \lor \neg \left(b \leq 600\right) \land b \leq 11000000:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.02e-96)
   (+ (/ -0.6666666666666666 (/ a b)) (* 0.5 (/ c b)))
   (if (or (<= b 4.1e-132) (and (not (<= b 600.0)) (<= b 11000000.0)))
     (/ (- (sqrt (* a (* c -3.0))) b) (* 3.0 a))
     (/ (* c -0.5) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.02e-96) {
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	} else if ((b <= 4.1e-132) || (!(b <= 600.0) && (b <= 11000000.0))) {
		tmp = (sqrt((a * (c * -3.0))) - b) / (3.0 * a);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-1.02d-96)) then
        tmp = ((-0.6666666666666666d0) / (a / b)) + (0.5d0 * (c / b))
    else if ((b <= 4.1d-132) .or. (.not. (b <= 600.0d0)) .and. (b <= 11000000.0d0)) then
        tmp = (sqrt((a * (c * (-3.0d0)))) - b) / (3.0d0 * a)
    else
        tmp = (c * (-0.5d0)) / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.02e-96) {
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	} else if ((b <= 4.1e-132) || (!(b <= 600.0) && (b <= 11000000.0))) {
		tmp = (Math.sqrt((a * (c * -3.0))) - b) / (3.0 * a);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.02e-96:
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b))
	elif (b <= 4.1e-132) or (not (b <= 600.0) and (b <= 11000000.0)):
		tmp = (math.sqrt((a * (c * -3.0))) - b) / (3.0 * a)
	else:
		tmp = (c * -0.5) / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.02e-96)
		tmp = Float64(Float64(-0.6666666666666666 / Float64(a / b)) + Float64(0.5 * Float64(c / b)));
	elseif ((b <= 4.1e-132) || (!(b <= 600.0) && (b <= 11000000.0)))
		tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / Float64(3.0 * a));
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.02e-96)
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	elseif ((b <= 4.1e-132) || (~((b <= 600.0)) && (b <= 11000000.0)))
		tmp = (sqrt((a * (c * -3.0))) - b) / (3.0 * a);
	else
		tmp = (c * -0.5) / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.02e-96], N[(N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 4.1e-132], And[N[Not[LessEqual[b, 600.0]], $MachinePrecision], LessEqual[b, 11000000.0]]], N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 4.1 \cdot 10^{-132} \lor \neg \left(b \leq 600\right) \land b \leq 11000000:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{3 \cdot a}\\

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


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

    1. Initial program 63.4%

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

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

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} + 0.5 \cdot \frac{c}{b} \]
      2. un-div-inv87.9%

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

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

    if -1.02000000000000007e-96 < b < 4.10000000000000007e-132 or 600 < b < 1.1e7

    1. Initial program 82.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.10000000000000007e-132 < b < 600 or 1.1e7 < b

    1. Initial program 18.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.02 \cdot 10^{-96}:\\ \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 4.1 \cdot 10^{-132} \lor \neg \left(b \leq 600\right) \land b \leq 11000000:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 79.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.02 \cdot 10^{-96}:\\ \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 3 \cdot 10^{-137} \lor \neg \left(b \leq 1100\right) \land b \leq 40000000:\\ \;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.02e-96)
   (+ (/ -0.6666666666666666 (/ a b)) (* 0.5 (/ c b)))
   (if (or (<= b 3e-137) (and (not (<= b 1100.0)) (<= b 40000000.0)))
     (/ (- (sqrt (* -3.0 (* a c))) b) (* 3.0 a))
     (/ (* c -0.5) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.02e-96) {
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	} else if ((b <= 3e-137) || (!(b <= 1100.0) && (b <= 40000000.0))) {
		tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-1.02d-96)) then
        tmp = ((-0.6666666666666666d0) / (a / b)) + (0.5d0 * (c / b))
    else if ((b <= 3d-137) .or. (.not. (b <= 1100.0d0)) .and. (b <= 40000000.0d0)) then
        tmp = (sqrt(((-3.0d0) * (a * c))) - b) / (3.0d0 * a)
    else
        tmp = (c * (-0.5d0)) / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.02e-96) {
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	} else if ((b <= 3e-137) || (!(b <= 1100.0) && (b <= 40000000.0))) {
		tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.02e-96:
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b))
	elif (b <= 3e-137) or (not (b <= 1100.0) and (b <= 40000000.0)):
		tmp = (math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a)
	else:
		tmp = (c * -0.5) / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.02e-96)
		tmp = Float64(Float64(-0.6666666666666666 / Float64(a / b)) + Float64(0.5 * Float64(c / b)));
	elseif ((b <= 3e-137) || (!(b <= 1100.0) && (b <= 40000000.0)))
		tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(3.0 * a));
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.02e-96)
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	elseif ((b <= 3e-137) || (~((b <= 1100.0)) && (b <= 40000000.0)))
		tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
	else
		tmp = (c * -0.5) / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.02e-96], N[(N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 3e-137], And[N[Not[LessEqual[b, 1100.0]], $MachinePrecision], LessEqual[b, 40000000.0]]], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 3 \cdot 10^{-137} \lor \neg \left(b \leq 1100\right) \land b \leq 40000000:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\

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


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

    1. Initial program 63.4%

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

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

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} + 0.5 \cdot \frac{c}{b} \]
      2. un-div-inv87.9%

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

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

    if -1.02000000000000007e-96 < b < 2.9999999999999998e-137 or 1100 < b < 4e7

    1. Initial program 82.7%

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

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

    if 2.9999999999999998e-137 < b < 1100 or 4e7 < b

    1. Initial program 18.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.02 \cdot 10^{-96}:\\ \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 3 \cdot 10^{-137} \lor \neg \left(b \leq 1100\right) \land b \leq 40000000:\\ \;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 79.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.02 \cdot 10^{-96}:\\ \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 1.6 \cdot 10^{-133}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 11000000\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.02e-96)
   (+ (/ -0.6666666666666666 (/ a b)) (* 0.5 (/ c b)))
   (if (<= b 1.6e-133)
     (/ (- (sqrt (* c (* a -3.0))) b) (* 3.0 a))
     (if (or (<= b 1100.0) (not (<= b 11000000.0)))
       (/ (* c -0.5) b)
       (/ (- (sqrt (* -3.0 (* a c))) b) (* 3.0 a))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.02e-96) {
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	} else if (b <= 1.6e-133) {
		tmp = (sqrt((c * (a * -3.0))) - b) / (3.0 * a);
	} else if ((b <= 1100.0) || !(b <= 11000000.0)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
	}
	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.02d-96)) then
        tmp = ((-0.6666666666666666d0) / (a / b)) + (0.5d0 * (c / b))
    else if (b <= 1.6d-133) then
        tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (3.0d0 * a)
    else if ((b <= 1100.0d0) .or. (.not. (b <= 11000000.0d0))) then
        tmp = (c * (-0.5d0)) / b
    else
        tmp = (sqrt(((-3.0d0) * (a * c))) - b) / (3.0d0 * a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.02e-96) {
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	} else if (b <= 1.6e-133) {
		tmp = (Math.sqrt((c * (a * -3.0))) - b) / (3.0 * a);
	} else if ((b <= 1100.0) || !(b <= 11000000.0)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.02e-96:
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b))
	elif b <= 1.6e-133:
		tmp = (math.sqrt((c * (a * -3.0))) - b) / (3.0 * a)
	elif (b <= 1100.0) or not (b <= 11000000.0):
		tmp = (c * -0.5) / b
	else:
		tmp = (math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.02e-96)
		tmp = Float64(Float64(-0.6666666666666666 / Float64(a / b)) + Float64(0.5 * Float64(c / b)));
	elseif (b <= 1.6e-133)
		tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(3.0 * a));
	elseif ((b <= 1100.0) || !(b <= 11000000.0))
		tmp = Float64(Float64(c * -0.5) / b);
	else
		tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(3.0 * a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.02e-96)
		tmp = (-0.6666666666666666 / (a / b)) + (0.5 * (c / b));
	elseif (b <= 1.6e-133)
		tmp = (sqrt((c * (a * -3.0))) - b) / (3.0 * a);
	elseif ((b <= 1100.0) || ~((b <= 11000000.0)))
		tmp = (c * -0.5) / b;
	else
		tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.02e-96], N[(N[(-0.6666666666666666 / N[(a / b), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.6e-133], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1100.0], N[Not[LessEqual[b, 11000000.0]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 11000000\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -1.02000000000000007e-96

    1. Initial program 63.4%

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

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

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} + 0.5 \cdot \frac{c}{b} \]
      2. un-div-inv87.9%

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

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

    if -1.02000000000000007e-96 < b < 1.60000000000000006e-133

    1. Initial program 81.1%

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

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

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

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

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

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

    if 1.60000000000000006e-133 < b < 1100 or 1.1e7 < b

    1. Initial program 18.6%

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

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

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

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

    if 1100 < b < 1.1e7

    1. Initial program 99.4%

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{-3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification85.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.02 \cdot 10^{-96}:\\ \;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 1.6 \cdot 10^{-133}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 11000000\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 84.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.6 \cdot 10^{+161}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 5.2 \cdot 10^{-130}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 21000000\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.6e+161)
   (/ (* b -2.0) (* 3.0 a))
   (if (<= b 5.2e-130)
     (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
     (if (or (<= b 1100.0) (not (<= b 21000000.0)))
       (/ (* c -0.5) b)
       (/ (- (sqrt (* -3.0 (* a c))) b) (* 3.0 a))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.6e+161) {
		tmp = (b * -2.0) / (3.0 * a);
	} else if (b <= 5.2e-130) {
		tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
	} else if ((b <= 1100.0) || !(b <= 21000000.0)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
	}
	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.6d+161)) then
        tmp = (b * (-2.0d0)) / (3.0d0 * a)
    else if (b <= 5.2d-130) then
        tmp = (sqrt(((b * b) - ((3.0d0 * a) * c))) - b) / (3.0d0 * a)
    else if ((b <= 1100.0d0) .or. (.not. (b <= 21000000.0d0))) then
        tmp = (c * (-0.5d0)) / b
    else
        tmp = (sqrt(((-3.0d0) * (a * c))) - b) / (3.0d0 * a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.6e+161) {
		tmp = (b * -2.0) / (3.0 * a);
	} else if (b <= 5.2e-130) {
		tmp = (Math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
	} else if ((b <= 1100.0) || !(b <= 21000000.0)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = (Math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.6e+161:
		tmp = (b * -2.0) / (3.0 * a)
	elif b <= 5.2e-130:
		tmp = (math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)
	elif (b <= 1100.0) or not (b <= 21000000.0):
		tmp = (c * -0.5) / b
	else:
		tmp = (math.sqrt((-3.0 * (a * c))) - b) / (3.0 * a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.6e+161)
		tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a));
	elseif (b <= 5.2e-130)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a));
	elseif ((b <= 1100.0) || !(b <= 21000000.0))
		tmp = Float64(Float64(c * -0.5) / b);
	else
		tmp = Float64(Float64(sqrt(Float64(-3.0 * Float64(a * c))) - b) / Float64(3.0 * a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.6e+161)
		tmp = (b * -2.0) / (3.0 * a);
	elseif (b <= 5.2e-130)
		tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
	elseif ((b <= 1100.0) || ~((b <= 21000000.0)))
		tmp = (c * -0.5) / b;
	else
		tmp = (sqrt((-3.0 * (a * c))) - b) / (3.0 * a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.6e+161], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.2e-130], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1100.0], N[Not[LessEqual[b, 21000000.0]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(N[(N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 21000000\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -1.60000000000000001e161

    1. Initial program 23.9%

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

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

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

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

    if -1.60000000000000001e161 < b < 5.2000000000000001e-130

    1. Initial program 86.3%

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

    if 5.2000000000000001e-130 < b < 1100 or 2.1e7 < b

    1. Initial program 18.6%

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

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

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

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

    if 1100 < b < 2.1e7

    1. Initial program 99.4%

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{-3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification87.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.6 \cdot 10^{+161}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 5.2 \cdot 10^{-130}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 1100 \lor \neg \left(b \leq 21000000\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{3 \cdot a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 66.4% accurate, 7.2× speedup?

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

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

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


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

    1. Initial program 67.6%

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 32.6%

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

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

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

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

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

Alternative 9: 66.4% accurate, 7.2× speedup?

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

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

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


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

    1. Initial program 67.6%

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} + 0.5 \cdot \frac{c}{b} \]
    5. Applied egg-rr69.7%

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

    if -4.999999999999985e-310 < b

    1. Initial program 32.6%

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

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

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

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

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

Alternative 10: 66.2% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 67.0%

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

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

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

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

    if 1.5e-298 < b

    1. Initial program 32.9%

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

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

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

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

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

Alternative 11: 66.3% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 67.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.7999999999999999e-293 < b

    1. Initial program 32.9%

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

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

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

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

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

Alternative 12: 42.4% accurate, 11.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.006:\\
\;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\

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


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

    1. Initial program 65.1%

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

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

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

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

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

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

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

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

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

    if 0.0060000000000000001 < 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. Add Preprocessing
    3. Taylor expanded in b around -inf 2.6%

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    4. Taylor expanded in b around 0 25.5%

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

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

Alternative 13: 65.9% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 67.0%

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

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

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

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

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

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

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

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

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

    if 2.8e-302 < b

    1. Initial program 32.9%

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

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

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

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

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

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

Alternative 14: 66.3% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 67.0%

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

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

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

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

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

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

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

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

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

    if 2.8e-302 < b

    1. Initial program 32.9%

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

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

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

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

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

Alternative 15: 66.3% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 67.0%

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

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

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

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

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

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

    if 2.50000000000000006e-301 < b

    1. Initial program 32.9%

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

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

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

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

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

Alternative 16: 10.9% accurate, 23.2× speedup?

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

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

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

    \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
  4. Taylor expanded in b around 0 10.3%

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

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

Reproduce

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