Cubic critical

Percentage Accurate: 51.9% → 85.8%
Time: 15.8s
Alternatives: 9
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 9 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: 85.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.56 \cdot 10^{+88}:\\ \;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\ \mathbf{elif}\;b \leq 6.2 \cdot 10^{-36}:\\ \;\;\;\;\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 -1.56e+88)
   (* (/ b a) -0.6666666666666666)
   (if (<= b 6.2e-36)
     (/ (- (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 <= -1.56e+88) {
		tmp = (b / a) * -0.6666666666666666;
	} else if (b <= 6.2e-36) {
		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 <= (-1.56d+88)) then
        tmp = (b / a) * (-0.6666666666666666d0)
    else if (b <= 6.2d-36) 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 <= -1.56e+88) {
		tmp = (b / a) * -0.6666666666666666;
	} else if (b <= 6.2e-36) {
		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 <= -1.56e+88:
		tmp = (b / a) * -0.6666666666666666
	elif b <= 6.2e-36:
		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 <= -1.56e+88)
		tmp = Float64(Float64(b / a) * -0.6666666666666666);
	elseif (b <= 6.2e-36)
		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 <= -1.56e+88)
		tmp = (b / a) * -0.6666666666666666;
	elseif (b <= 6.2e-36)
		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, -1.56e+88], N[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $MachinePrecision], If[LessEqual[b, 6.2e-36], 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 -1.56 \cdot 10^{+88}:\\
\;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\

\mathbf{elif}\;b \leq 6.2 \cdot 10^{-36}:\\
\;\;\;\;\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 < -1.56000000000000008e88

    1. Initial program 49.0%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. frac-2negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)}{\color{blue}{\mathsf{neg}\left(3 \cdot a\right)}} \]
      2. div-invN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)\right) \cdot \color{blue}{\frac{1}{\mathsf{neg}\left(3 \cdot a\right)}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)\right), \color{blue}{\left(\frac{1}{\mathsf{neg}\left(3 \cdot a\right)}\right)}\right) \]
    4. Applied egg-rr49.0%

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

      \[\leadsto \color{blue}{\frac{-2}{3} \cdot \frac{b}{a}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{b}{a} \cdot \color{blue}{\frac{-2}{3}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{b}{a}\right), \color{blue}{\frac{-2}{3}}\right) \]
      3. /-lowering-/.f6496.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, a\right), \frac{-2}{3}\right) \]
    7. Simplified96.5%

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

    if -1.56000000000000008e88 < b < 6.1999999999999997e-36

    1. Initial program 79.5%

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

    if 6.1999999999999997e-36 < b

    1. Initial program 14.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

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

        \[\leadsto \frac{\frac{-1}{2} \cdot c}{\color{blue}{b}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{-1}{2} \cdot c\right), \color{blue}{b}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(c \cdot \frac{-1}{2}\right), b\right) \]
      4. *-lowering-*.f6489.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \frac{-1}{2}\right), b\right) \]
    5. Simplified89.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.56 \cdot 10^{+88}:\\ \;\;\;\;\frac{b}{a} \cdot -0.6666666666666666\\ \mathbf{elif}\;b \leq 6.2 \cdot 10^{-36}:\\ \;\;\;\;\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: 85.9% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 49.0%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. frac-2negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)}{\color{blue}{\mathsf{neg}\left(3 \cdot a\right)}} \]
      2. div-invN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)\right) \cdot \color{blue}{\frac{1}{\mathsf{neg}\left(3 \cdot a\right)}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)\right), \color{blue}{\left(\frac{1}{\mathsf{neg}\left(3 \cdot a\right)}\right)}\right) \]
    4. Applied egg-rr49.0%

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

      \[\leadsto \color{blue}{\frac{-2}{3} \cdot \frac{b}{a}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{b}{a} \cdot \color{blue}{\frac{-2}{3}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{b}{a}\right), \color{blue}{\frac{-2}{3}}\right) \]
      3. /-lowering-/.f6496.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, a\right), \frac{-2}{3}\right) \]
    7. Simplified96.5%

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

    if -6.5000000000000002e88 < b < 1.8e-41

    1. Initial program 79.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. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right), \color{blue}{\left(3 \cdot a\right)}\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)\right), \left(\color{blue}{3} \cdot a\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b\right), \left(\color{blue}{3} \cdot a\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right), b\right), \left(\color{blue}{3} \cdot a\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b + \left(\mathsf{neg}\left(\left(3 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\left(b \cdot b\right), \left(\mathsf{neg}\left(\left(3 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(3 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(a \cdot 3\right) \cdot c\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(a \cdot \left(3 \cdot c\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(3 \cdot c\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(c \cdot 3\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(\mathsf{neg}\left(c \cdot 3\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(c \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -3\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      17. *-lowering-*.f6479.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -3\right)\right)\right)\right), b\right), \mathsf{*.f64}\left(3, \color{blue}{a}\right)\right) \]
    3. Simplified79.5%

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

    if 1.8e-41 < b

    1. Initial program 14.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

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

        \[\leadsto \frac{\frac{-1}{2} \cdot c}{\color{blue}{b}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{-1}{2} \cdot c\right), \color{blue}{b}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(c \cdot \frac{-1}{2}\right), b\right) \]
      4. *-lowering-*.f6489.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \frac{-1}{2}\right), b\right) \]
    5. Simplified89.0%

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

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

Alternative 3: 85.9% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 47.1%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. frac-2negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)}{\color{blue}{\mathsf{neg}\left(3 \cdot a\right)}} \]
      2. div-invN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)\right) \cdot \color{blue}{\frac{1}{\mathsf{neg}\left(3 \cdot a\right)}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)\right), \color{blue}{\left(\frac{1}{\mathsf{neg}\left(3 \cdot a\right)}\right)}\right) \]
    4. Applied egg-rr47.2%

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

      \[\leadsto \color{blue}{\frac{-2}{3} \cdot \frac{b}{a}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{b}{a} \cdot \color{blue}{\frac{-2}{3}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{b}{a}\right), \color{blue}{\frac{-2}{3}}\right) \]
      3. /-lowering-/.f6496.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, a\right), \frac{-2}{3}\right) \]
    7. Simplified96.3%

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

    if -1.7000000000000001e94 < b < 1.8e-41

    1. Initial program 79.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{3 \cdot a}{\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}} \]
      2. associate-/r/N/A

        \[\leadsto \frac{1}{3 \cdot a} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{3 \cdot a}\right), \color{blue}{\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\right) \]
      4. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{1}{3}}{a}\right), \left(\color{blue}{\left(\mathsf{neg}\left(b\right)\right)} + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{3}\right), a\right), \left(\color{blue}{\left(\mathsf{neg}\left(b\right)\right)} + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{3}, a\right), \left(\left(\mathsf{neg}\left(\color{blue}{b}\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{3}, a\right), \left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + \color{blue}{\left(\mathsf{neg}\left(b\right)\right)}\right)\right) \]
      8. unsub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{3}, a\right), \left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - \color{blue}{b}\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{3}, a\right), \mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right), \color{blue}{b}\right)\right) \]
    4. Applied egg-rr79.8%

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

    if 1.8e-41 < b

    1. Initial program 14.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

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

        \[\leadsto \frac{\frac{-1}{2} \cdot c}{\color{blue}{b}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{-1}{2} \cdot c\right), \color{blue}{b}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(c \cdot \frac{-1}{2}\right), b\right) \]
      4. *-lowering-*.f6489.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \frac{-1}{2}\right), b\right) \]
    5. Simplified89.0%

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

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

Alternative 4: 81.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.3 \cdot 10^{-62}:\\
\;\;\;\;b \cdot \left(\frac{\frac{c}{b}}{b} \cdot \left(0 - -0.5\right) - \frac{0.6666666666666666}{a}\right)\\

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

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


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

    1. Initial program 66.7%

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

      \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right)\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(b \cdot \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right) \cdot b\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right) \cdot \color{blue}{\left(\mathsf{neg}\left(b\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right), \color{blue}{\left(\mathsf{neg}\left(b\right)\right)}\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}}\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(\color{blue}{b}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left(\frac{c}{{b}^{2}}\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left(\frac{c}{b \cdot b}\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      8. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left(\frac{\frac{c}{b}}{b}\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\left(\frac{c}{b}\right), b\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      11. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \left(\frac{\frac{2}{3} \cdot 1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \left(\frac{\frac{2}{3}}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \mathsf{/.f64}\left(\frac{2}{3}, a\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      14. neg-sub0N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \mathsf{/.f64}\left(\frac{2}{3}, a\right)\right), \left(0 - \color{blue}{b}\right)\right) \]
      15. --lowering--.f6485.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \mathsf{/.f64}\left(\frac{2}{3}, a\right)\right), \mathsf{\_.f64}\left(0, \color{blue}{b}\right)\right) \]
    5. Simplified85.9%

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

    if -5.2999999999999997e-62 < b < 8.59999999999999991e-87

    1. Initial program 78.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. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right), \color{blue}{\left(3 \cdot a\right)}\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)\right), \left(\color{blue}{3} \cdot a\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b\right), \left(\color{blue}{3} \cdot a\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right), b\right), \left(\color{blue}{3} \cdot a\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b + \left(\mathsf{neg}\left(\left(3 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\left(b \cdot b\right), \left(\mathsf{neg}\left(\left(3 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(3 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(a \cdot 3\right) \cdot c\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(a \cdot \left(3 \cdot c\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(3 \cdot c\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(c \cdot 3\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(\mathsf{neg}\left(c \cdot 3\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(c \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -3\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      17. *-lowering-*.f6478.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -3\right)\right)\right)\right), b\right), \mathsf{*.f64}\left(3, \color{blue}{a}\right)\right) \]
    3. Simplified78.0%

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(\left(-3 \cdot a\right) \cdot c\right)\right), b\right), \mathsf{*.f64}\left(3, a\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(c \cdot \left(-3 \cdot a\right)\right)\right), b\right), \mathsf{*.f64}\left(3, a\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \left(-3 \cdot a\right)\right)\right), b\right), \mathsf{*.f64}\left(3, a\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \left(a \cdot -3\right)\right)\right), b\right), \mathsf{*.f64}\left(3, a\right)\right) \]
      5. *-lowering-*.f6472.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \mathsf{*.f64}\left(a, -3\right)\right)\right), b\right), \mathsf{*.f64}\left(3, a\right)\right) \]
    7. Simplified72.7%

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

    if 8.59999999999999991e-87 < b

    1. Initial program 18.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

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

        \[\leadsto \frac{\frac{-1}{2} \cdot c}{\color{blue}{b}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{-1}{2} \cdot c\right), \color{blue}{b}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(c \cdot \frac{-1}{2}\right), b\right) \]
      4. *-lowering-*.f6483.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \frac{-1}{2}\right), b\right) \]
    5. Simplified83.3%

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

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

Alternative 5: 81.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.65 \cdot 10^{-60}:\\
\;\;\;\;b \cdot \left(\frac{\frac{c}{b}}{b} \cdot \left(0 - -0.5\right) - \frac{0.6666666666666666}{a}\right)\\

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

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


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

    1. Initial program 66.7%

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

      \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right)\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(b \cdot \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right) \cdot b\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right) \cdot \color{blue}{\left(\mathsf{neg}\left(b\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right), \color{blue}{\left(\mathsf{neg}\left(b\right)\right)}\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}}\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(\color{blue}{b}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left(\frac{c}{{b}^{2}}\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left(\frac{c}{b \cdot b}\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      8. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left(\frac{\frac{c}{b}}{b}\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\left(\frac{c}{b}\right), b\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      11. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \left(\frac{\frac{2}{3} \cdot 1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \left(\frac{\frac{2}{3}}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \mathsf{/.f64}\left(\frac{2}{3}, a\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      14. neg-sub0N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \mathsf{/.f64}\left(\frac{2}{3}, a\right)\right), \left(0 - \color{blue}{b}\right)\right) \]
      15. --lowering--.f6485.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \mathsf{/.f64}\left(\frac{2}{3}, a\right)\right), \mathsf{\_.f64}\left(0, \color{blue}{b}\right)\right) \]
    5. Simplified85.9%

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

    if -1.6499999999999999e-60 < b < 8.00000000000000014e-87

    1. Initial program 78.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. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right), \color{blue}{\left(3 \cdot a\right)}\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + \left(\mathsf{neg}\left(b\right)\right)\right), \left(\color{blue}{3} \cdot a\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b\right), \left(\color{blue}{3} \cdot a\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right), b\right), \left(\color{blue}{3} \cdot a\right)\right) \]
      5. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(b \cdot b + \left(\mathsf{neg}\left(\left(3 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      7. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\left(b \cdot b\right), \left(\mathsf{neg}\left(\left(3 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(3 \cdot a\right) \cdot c\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(\left(a \cdot 3\right) \cdot c\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(\mathsf{neg}\left(a \cdot \left(3 \cdot c\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      11. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(3 \cdot c\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \left(a \cdot \left(\mathsf{neg}\left(c \cdot 3\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(\mathsf{neg}\left(c \cdot 3\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \left(c \cdot \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, \left(\mathsf{neg}\left(3\right)\right)\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -3\right)\right)\right)\right), b\right), \left(3 \cdot a\right)\right) \]
      17. *-lowering-*.f6478.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(b, b\right), \mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -3\right)\right)\right)\right), b\right), \mathsf{*.f64}\left(3, \color{blue}{a}\right)\right) \]
    3. Simplified78.0%

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(\left(-3 \cdot a\right) \cdot c\right)\right), b\right), \mathsf{*.f64}\left(3, a\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(c \cdot \left(-3 \cdot a\right)\right)\right), b\right), \mathsf{*.f64}\left(3, a\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \left(-3 \cdot a\right)\right)\right), b\right), \mathsf{*.f64}\left(3, a\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \left(a \cdot -3\right)\right)\right), b\right), \mathsf{*.f64}\left(3, a\right)\right) \]
      5. *-lowering-*.f6472.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(c, \mathsf{*.f64}\left(a, -3\right)\right)\right), b\right), \mathsf{*.f64}\left(3, a\right)\right) \]
    7. Simplified72.7%

      \[\leadsto \frac{\sqrt{\color{blue}{c \cdot \left(a \cdot -3\right)}} - b}{3 \cdot a} \]
    8. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{3 \cdot a}{\sqrt{c \cdot \left(a \cdot -3\right)} - b}}} \]
      2. associate-/r/N/A

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

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

        \[\leadsto \frac{\frac{1}{3}}{a} \cdot \left(\sqrt{\color{blue}{c \cdot \left(a \cdot -3\right)}} - b\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{1}{3}}{a}\right), \color{blue}{\left(\sqrt{c \cdot \left(a \cdot -3\right)} - b\right)}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{3}, a\right), \left(\color{blue}{\sqrt{c \cdot \left(a \cdot -3\right)}} - b\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{3}, a\right), \mathsf{\_.f64}\left(\left(\sqrt{c \cdot \left(a \cdot -3\right)}\right), \color{blue}{b}\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{3}, a\right), \mathsf{\_.f64}\left(\left(\sqrt{c \cdot \left(-3 \cdot a\right)}\right), b\right)\right) \]
      9. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{3}, a\right), \mathsf{\_.f64}\left(\left(\sqrt{\left(c \cdot -3\right) \cdot a}\right), b\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{3}, a\right), \mathsf{\_.f64}\left(\left(\sqrt{a \cdot \left(c \cdot -3\right)}\right), b\right)\right) \]
      11. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{3}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\left(a \cdot \left(c \cdot -3\right)\right)\right), b\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{3}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(a, \left(c \cdot -3\right)\right)\right), b\right)\right) \]
      13. *-lowering-*.f6472.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{3}, a\right), \mathsf{\_.f64}\left(\mathsf{sqrt.f64}\left(\mathsf{*.f64}\left(a, \mathsf{*.f64}\left(c, -3\right)\right)\right), b\right)\right) \]
    9. Applied egg-rr72.5%

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

    if 8.00000000000000014e-87 < b

    1. Initial program 18.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

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

        \[\leadsto \frac{\frac{-1}{2} \cdot c}{\color{blue}{b}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{-1}{2} \cdot c\right), \color{blue}{b}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(c \cdot \frac{-1}{2}\right), b\right) \]
      4. *-lowering-*.f6483.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \frac{-1}{2}\right), b\right) \]
    5. Simplified83.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.65 \cdot 10^{-60}:\\ \;\;\;\;b \cdot \left(\frac{\frac{c}{b}}{b} \cdot \left(0 - -0.5\right) - \frac{0.6666666666666666}{a}\right)\\ \mathbf{elif}\;b \leq 8 \cdot 10^{-87}:\\ \;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(\sqrt{a \cdot \left(c \cdot -3\right)} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 68.5% accurate, 5.8× speedup?

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

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

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


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

    1. Initial program 70.8%

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

      \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right)\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(b \cdot \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right) \cdot b\right) \]
      3. distribute-rgt-neg-inN/A

        \[\leadsto \left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right) \cdot \color{blue}{\left(\mathsf{neg}\left(b\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}} + \frac{2}{3} \cdot \frac{1}{a}\right), \color{blue}{\left(\mathsf{neg}\left(b\right)\right)}\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\left(\frac{-1}{2} \cdot \frac{c}{{b}^{2}}\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(\color{blue}{b}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left(\frac{c}{{b}^{2}}\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left(\frac{c}{b \cdot b}\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      8. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left(\frac{\frac{c}{b}}{b}\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\left(\frac{c}{b}\right), b\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \left(\frac{2}{3} \cdot \frac{1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      11. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \left(\frac{\frac{2}{3} \cdot 1}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \left(\frac{\frac{2}{3}}{a}\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \mathsf{/.f64}\left(\frac{2}{3}, a\right)\right), \left(\mathsf{neg}\left(b\right)\right)\right) \]
      14. neg-sub0N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \mathsf{/.f64}\left(\frac{2}{3}, a\right)\right), \left(0 - \color{blue}{b}\right)\right) \]
      15. --lowering--.f6467.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(c, b\right), b\right)\right), \mathsf{/.f64}\left(\frac{2}{3}, a\right)\right), \mathsf{\_.f64}\left(0, \color{blue}{b}\right)\right) \]
    5. Simplified67.0%

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

    if -9.999999999999969e-311 < b

    1. Initial program 34.8%

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

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

        \[\leadsto \frac{\frac{-1}{2} \cdot c}{\color{blue}{b}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{-1}{2} \cdot c\right), \color{blue}{b}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(c \cdot \frac{-1}{2}\right), b\right) \]
      4. *-lowering-*.f6464.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \frac{-1}{2}\right), b\right) \]
    5. Simplified64.2%

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

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

Alternative 7: 68.3% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 70.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. frac-2negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)}{\color{blue}{\mathsf{neg}\left(3 \cdot a\right)}} \]
      2. div-invN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)\right) \cdot \color{blue}{\frac{1}{\mathsf{neg}\left(3 \cdot a\right)}} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)\right), \color{blue}{\left(\frac{1}{\mathsf{neg}\left(3 \cdot a\right)}\right)}\right) \]
    4. Applied egg-rr70.8%

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

      \[\leadsto \color{blue}{\frac{-2}{3} \cdot \frac{b}{a}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{b}{a} \cdot \color{blue}{\frac{-2}{3}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{b}{a}\right), \color{blue}{\frac{-2}{3}}\right) \]
      3. /-lowering-/.f6466.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, a\right), \frac{-2}{3}\right) \]
    7. Simplified66.9%

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

    if -9.999999999999969e-311 < b

    1. Initial program 34.8%

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

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

        \[\leadsto \frac{\frac{-1}{2} \cdot c}{\color{blue}{b}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{-1}{2} \cdot c\right), \color{blue}{b}\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(c \cdot \frac{-1}{2}\right), b\right) \]
      4. *-lowering-*.f6464.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(c, \frac{-1}{2}\right), b\right) \]
    5. Simplified64.2%

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

Alternative 8: 35.4% accurate, 23.2× speedup?

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

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. frac-2negN/A

      \[\leadsto \frac{\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)}{\color{blue}{\mathsf{neg}\left(3 \cdot a\right)}} \]
    2. div-invN/A

      \[\leadsto \left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)\right) \cdot \color{blue}{\frac{1}{\mathsf{neg}\left(3 \cdot a\right)}} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\mathsf{neg}\left(\left(\left(\mathsf{neg}\left(b\right)\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)\right), \color{blue}{\left(\frac{1}{\mathsf{neg}\left(3 \cdot a\right)}\right)}\right) \]
  4. Applied egg-rr53.2%

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

    \[\leadsto \color{blue}{\frac{-2}{3} \cdot \frac{b}{a}} \]
  6. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \frac{b}{a} \cdot \color{blue}{\frac{-2}{3}} \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{b}{a}\right), \color{blue}{\frac{-2}{3}}\right) \]
    3. /-lowering-/.f6435.6%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(b, a\right), \frac{-2}{3}\right) \]
  7. Simplified35.6%

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

Alternative 9: 35.4% accurate, 23.2× speedup?

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

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

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

    \[\leadsto \color{blue}{\frac{-2}{3} \cdot \frac{b}{a}} \]
  4. Step-by-step derivation
    1. associate-*r/N/A

      \[\leadsto \frac{\frac{-2}{3} \cdot b}{\color{blue}{a}} \]
    2. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{-2}{3} \cdot b\right), \color{blue}{a}\right) \]
    3. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\left(b \cdot \frac{-2}{3}\right), a\right) \]
    4. *-lowering-*.f6435.6%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(b, \frac{-2}{3}\right), a\right) \]
  5. Simplified35.6%

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

      \[\leadsto b \cdot \color{blue}{\frac{\frac{-2}{3}}{a}} \]
    2. *-commutativeN/A

      \[\leadsto \frac{\frac{-2}{3}}{a} \cdot \color{blue}{b} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{\frac{-2}{3}}{a}\right), \color{blue}{b}\right) \]
    4. /-lowering-/.f6435.6%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-2}{3}, a\right), b\right) \]
  7. Applied egg-rr35.6%

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

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

Reproduce

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