Cubic critical

Percentage Accurate: 51.7% → 84.7%
Time: 12.1s
Alternatives: 15
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 15 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.7% 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.7% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 39.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 97.2%

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

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

      \[\leadsto \frac{\color{blue}{b \cdot -2}}{3 \cdot a} \]
    6. Step-by-step derivation
      1. clear-num97.2%

        \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{b \cdot -2}}} \]
      2. inv-pow97.2%

        \[\leadsto \color{blue}{{\left(\frac{3 \cdot a}{b \cdot -2}\right)}^{-1}} \]
      3. *-commutative97.2%

        \[\leadsto {\left(\frac{3 \cdot a}{\color{blue}{-2 \cdot b}}\right)}^{-1} \]
      4. times-frac97.3%

        \[\leadsto {\color{blue}{\left(\frac{3}{-2} \cdot \frac{a}{b}\right)}}^{-1} \]
      5. metadata-eval97.3%

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

      \[\leadsto \color{blue}{{\left(-1.5 \cdot \frac{a}{b}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. unpow-197.3%

        \[\leadsto \color{blue}{\frac{1}{-1.5 \cdot \frac{a}{b}}} \]
      2. associate-/r*97.4%

        \[\leadsto \color{blue}{\frac{\frac{1}{-1.5}}{\frac{a}{b}}} \]
      3. metadata-eval97.4%

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

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

    if -6.2999999999999996e151 < b < 2.0000000000000001e-22

    1. Initial program 79.1%

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

    if 2.0000000000000001e-22 < b

    1. Initial program 11.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 88.6%

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

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

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

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

Alternative 2: 79.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 66.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 86.6%

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

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot b\right) \cdot \left(2 + -1.5 \cdot \frac{a \cdot c}{{b}^{2}}\right)}}{3 \cdot a} \]
      2. mul-1-neg86.6%

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

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

      \[\leadsto \frac{\color{blue}{\left(-b\right) \cdot \left(2 + -1.5 \cdot \left(a \cdot \frac{c}{{b}^{2}}\right)\right)}}{3 \cdot a} \]
    6. Taylor expanded in a around inf 87.8%

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

    if -7.50000000000000047e-61 < b < 3.3e-20

    1. Initial program 73.5%

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

      \[\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*66.7%

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

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

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

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

    if 3.3e-20 < b

    1. Initial program 11.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 88.6%

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

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

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

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

Alternative 3: 79.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 66.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 86.6%

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

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot b\right) \cdot \left(2 + -1.5 \cdot \frac{a \cdot c}{{b}^{2}}\right)}}{3 \cdot a} \]
      2. mul-1-neg86.6%

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

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

      \[\leadsto \frac{\color{blue}{\left(-b\right) \cdot \left(2 + -1.5 \cdot \left(a \cdot \frac{c}{{b}^{2}}\right)\right)}}{3 \cdot a} \]
    6. Taylor expanded in a around inf 87.8%

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

    if -3.7500000000000001e-60 < b < 1.02000000000000002e-22

    1. Initial program 73.5%

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

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

    if 1.02000000000000002e-22 < b

    1. Initial program 11.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 88.6%

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

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

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

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

Alternative 4: 79.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 66.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 86.6%

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

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot b\right) \cdot \left(2 + -1.5 \cdot \frac{a \cdot c}{{b}^{2}}\right)}}{3 \cdot a} \]
      2. mul-1-neg86.6%

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

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

      \[\leadsto \frac{\color{blue}{\left(-b\right) \cdot \left(2 + -1.5 \cdot \left(a \cdot \frac{c}{{b}^{2}}\right)\right)}}{3 \cdot a} \]
    6. Taylor expanded in a around inf 87.8%

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

    if -2.04999999999999999e-61 < b < 2.40000000000000002e-22

    1. Initial program 73.5%

      \[\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. prod-diff73.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -c \cdot \left(3 \cdot a\right)\right) + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}}{3 \cdot a} \]
      2. distribute-rgt-neg-in73.0%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \color{blue}{\left(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(3 \cdot a\right) \cdot c\right)}}}{3 \cdot a} \]
      8. distribute-lft-neg-in73.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(\color{blue}{\left(-c \cdot \left(3 \cdot a\right)\right)} + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      9. distribute-rgt-neg-in73.0%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \left(-\color{blue}{a \cdot 3}\right) + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      11. distribute-rgt-neg-in73.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \color{blue}{\left(a \cdot \left(-3\right)\right)} + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      12. metadata-eval73.0%

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \left(a \cdot -3\right) + a \cdot \left(3 \cdot c\right)\right)}}}{3 \cdot a} \]
    5. Taylor expanded in b around 0 66.1%

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

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

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

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

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

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

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

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

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

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

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

    if 2.40000000000000002e-22 < b

    1. Initial program 11.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 88.6%

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

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

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

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

Alternative 5: 79.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 66.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 86.6%

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

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot b\right) \cdot \left(2 + -1.5 \cdot \frac{a \cdot c}{{b}^{2}}\right)}}{3 \cdot a} \]
      2. mul-1-neg86.6%

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

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

      \[\leadsto \frac{\color{blue}{\left(-b\right) \cdot \left(2 + -1.5 \cdot \left(a \cdot \frac{c}{{b}^{2}}\right)\right)}}{3 \cdot a} \]
    6. Taylor expanded in a around inf 87.8%

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

    if -8.4999999999999995e-62 < b < 1.02000000000000002e-22

    1. Initial program 73.5%

      \[\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. prod-diff73.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -c \cdot \left(3 \cdot a\right)\right) + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}}{3 \cdot a} \]
      2. distribute-rgt-neg-in73.0%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \color{blue}{\left(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(3 \cdot a\right) \cdot c\right)}}}{3 \cdot a} \]
      8. distribute-lft-neg-in73.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(\color{blue}{\left(-c \cdot \left(3 \cdot a\right)\right)} + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      9. distribute-rgt-neg-in73.0%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \left(-\color{blue}{a \cdot 3}\right) + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      11. distribute-rgt-neg-in73.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \color{blue}{\left(a \cdot \left(-3\right)\right)} + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      12. metadata-eval73.0%

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \left(a \cdot -3\right) + a \cdot \left(3 \cdot c\right)\right)}}}{3 \cdot a} \]
    5. Taylor expanded in b around 0 63.9%

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

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

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

        \[\leadsto 0.3333333333333333 \cdot \left(\frac{1}{a} \cdot \sqrt{\color{blue}{c \cdot \left(-6 \cdot a + 3 \cdot a\right)}}\right) \]
      4. associate-*l/64.6%

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

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

    if 1.02000000000000002e-22 < b

    1. Initial program 11.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 88.6%

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

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

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

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

Alternative 6: 69.5% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 8.5 \cdot 10^{-109}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt{\frac{c \cdot -3}{a}}\\

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


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

    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 89.3%

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

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot b\right) \cdot \left(2 + -1.5 \cdot \frac{a \cdot c}{{b}^{2}}\right)}}{3 \cdot a} \]
      2. mul-1-neg89.3%

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

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

      \[\leadsto \frac{\color{blue}{\left(-b\right) \cdot \left(2 + -1.5 \cdot \left(a \cdot \frac{c}{{b}^{2}}\right)\right)}}{3 \cdot a} \]
    6. Taylor expanded in a around inf 90.4%

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

    if -5.8000000000000001e-31 < b < 8.50000000000000005e-109

    1. Initial program 72.9%

      \[\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. prod-diff72.3%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -c \cdot \left(3 \cdot a\right)\right) + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}}{3 \cdot a} \]
      2. distribute-rgt-neg-in72.3%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \color{blue}{\left(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(3 \cdot a\right) \cdot c\right)}}}{3 \cdot a} \]
      8. distribute-lft-neg-in72.3%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(\color{blue}{\left(-c \cdot \left(3 \cdot a\right)\right)} + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      9. distribute-rgt-neg-in72.3%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \left(-\color{blue}{a \cdot 3}\right) + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      11. distribute-rgt-neg-in72.3%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \left(a \cdot \color{blue}{-3}\right) + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      13. *-commutative72.3%

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

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

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

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \sqrt{\frac{-6 \cdot c + 3 \cdot c}{a}}} \]
    6. Step-by-step derivation
      1. *-commutative36.3%

        \[\leadsto \color{blue}{\sqrt{\frac{-6 \cdot c + 3 \cdot c}{a}} \cdot 0.3333333333333333} \]
      2. distribute-rgt-out36.3%

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

        \[\leadsto \sqrt{\frac{c \cdot \color{blue}{-3}}{a}} \cdot 0.3333333333333333 \]
    7. Simplified36.3%

      \[\leadsto \color{blue}{\sqrt{\frac{c \cdot -3}{a}} \cdot 0.3333333333333333} \]

    if 8.50000000000000005e-109 < b

    1. Initial program 20.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 80.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.8 \cdot 10^{-31}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + \frac{c}{b} \cdot 0.5\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{-109}:\\ \;\;\;\;0.3333333333333333 \cdot \sqrt{\frac{c \cdot -3}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 67.5% accurate, 7.2× speedup?

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

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

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


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

    1. Initial program 68.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 68.3%

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

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot b\right) \cdot \left(2 + -1.5 \cdot \frac{a \cdot c}{{b}^{2}}\right)}}{3 \cdot a} \]
      2. mul-1-neg68.3%

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

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

      \[\leadsto \frac{\color{blue}{\left(-b\right) \cdot \left(2 + -1.5 \cdot \left(a \cdot \frac{c}{{b}^{2}}\right)\right)}}{3 \cdot a} \]
    6. Taylor expanded in a around inf 70.3%

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

    if -1.999999999999994e-310 < b

    1. Initial program 33.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 64.1%

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

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

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

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

Alternative 8: 67.4% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 68.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 69.2%

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

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

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

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

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

        \[\leadsto b \cdot \frac{\color{blue}{2}}{-3 \cdot a} \]
      4. *-commutative69.2%

        \[\leadsto b \cdot \frac{2}{-\color{blue}{a \cdot 3}} \]
      5. distribute-rgt-neg-in69.2%

        \[\leadsto b \cdot \frac{2}{\color{blue}{a \cdot \left(-3\right)}} \]
      6. metadata-eval69.2%

        \[\leadsto b \cdot \frac{2}{a \cdot \color{blue}{-3}} \]
    7. Applied egg-rr69.2%

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

    if 1.76000000000000006e-301 < b

    1. Initial program 33.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 64.5%

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

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

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

Alternative 9: 67.4% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 68.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. prod-diff67.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -c \cdot \left(3 \cdot a\right)\right) + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}}{3 \cdot a} \]
      2. distribute-rgt-neg-in67.8%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \color{blue}{\left(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(3 \cdot a\right) \cdot c\right)}}}{3 \cdot a} \]
      8. distribute-lft-neg-in67.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(\color{blue}{\left(-c \cdot \left(3 \cdot a\right)\right)} + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      9. distribute-rgt-neg-in67.8%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \left(-\color{blue}{a \cdot 3}\right) + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      11. distribute-rgt-neg-in67.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \color{blue}{\left(a \cdot \left(-3\right)\right)} + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      12. metadata-eval67.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.9e-301 < b

    1. Initial program 33.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 64.5%

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

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

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

Alternative 10: 67.3% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 68.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 69.2%

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

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

      \[\leadsto \frac{\color{blue}{b \cdot -2}}{3 \cdot a} \]
    6. Step-by-step derivation
      1. clear-num69.2%

        \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{b \cdot -2}}} \]
      2. inv-pow69.2%

        \[\leadsto \color{blue}{{\left(\frac{3 \cdot a}{b \cdot -2}\right)}^{-1}} \]
      3. *-commutative69.2%

        \[\leadsto {\left(\frac{3 \cdot a}{\color{blue}{-2 \cdot b}}\right)}^{-1} \]
      4. times-frac69.2%

        \[\leadsto {\color{blue}{\left(\frac{3}{-2} \cdot \frac{a}{b}\right)}}^{-1} \]
      5. metadata-eval69.2%

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

      \[\leadsto \color{blue}{{\left(-1.5 \cdot \frac{a}{b}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. unpow-169.2%

        \[\leadsto \color{blue}{\frac{1}{-1.5 \cdot \frac{a}{b}}} \]
      2. associate-/r*69.2%

        \[\leadsto \color{blue}{\frac{\frac{1}{-1.5}}{\frac{a}{b}}} \]
      3. metadata-eval69.2%

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

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

    if 7.7999999999999998e-302 < b

    1. Initial program 33.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 64.5%

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

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

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

Alternative 11: 67.3% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 68.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 69.2%

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

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

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

    if 6.90000000000000031e-302 < b

    1. Initial program 33.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 64.5%

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

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

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

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

Alternative 12: 67.2% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 68.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 69.2%

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

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

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

    if 3.24999999999999996e-301 < b

    1. Initial program 33.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 c around 0 56.2%

      \[\leadsto \color{blue}{c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - 0.5 \cdot \frac{1}{b}\right)} \]
    4. Step-by-step derivation
      1. associate-*r/56.2%

        \[\leadsto c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - \color{blue}{\frac{0.5 \cdot 1}{b}}\right) \]
      2. metadata-eval56.2%

        \[\leadsto c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - \frac{\color{blue}{0.5}}{b}\right) \]
    5. Simplified56.2%

      \[\leadsto \color{blue}{c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - \frac{0.5}{b}\right)} \]
    6. Taylor expanded in a around 0 64.3%

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

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

Alternative 13: 67.3% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 68.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. prod-diff67.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -c \cdot \left(3 \cdot a\right)\right) + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}}{3 \cdot a} \]
      2. distribute-rgt-neg-in67.8%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \color{blue}{\left(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(3 \cdot a\right) \cdot c\right)}}}{3 \cdot a} \]
      8. distribute-lft-neg-in67.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(\color{blue}{\left(-c \cdot \left(3 \cdot a\right)\right)} + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      9. distribute-rgt-neg-in67.8%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \left(-\color{blue}{a \cdot 3}\right) + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      11. distribute-rgt-neg-in67.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \color{blue}{\left(a \cdot \left(-3\right)\right)} + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      12. metadata-eval67.8%

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

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

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

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

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

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

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

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

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

    if 1.5e-301 < b

    1. Initial program 33.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 c around 0 56.2%

      \[\leadsto \color{blue}{c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - 0.5 \cdot \frac{1}{b}\right)} \]
    4. Step-by-step derivation
      1. associate-*r/56.2%

        \[\leadsto c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - \color{blue}{\frac{0.5 \cdot 1}{b}}\right) \]
      2. metadata-eval56.2%

        \[\leadsto c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - \frac{\color{blue}{0.5}}{b}\right) \]
    5. Simplified56.2%

      \[\leadsto \color{blue}{c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - \frac{0.5}{b}\right)} \]
    6. Taylor expanded in a around 0 64.3%

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

Alternative 14: 42.3% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 63.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. prod-diff62.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -c \cdot \left(3 \cdot a\right)\right) + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}}{3 \cdot a} \]
      2. distribute-rgt-neg-in62.8%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \color{blue}{\left(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(3 \cdot a\right) \cdot c\right)}}}{3 \cdot a} \]
      8. distribute-lft-neg-in62.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(\color{blue}{\left(-c \cdot \left(3 \cdot a\right)\right)} + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      9. distribute-rgt-neg-in62.8%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \left(-\color{blue}{a \cdot 3}\right) + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      11. distribute-rgt-neg-in62.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \color{blue}{\left(a \cdot \left(-3\right)\right)} + \left(3 \cdot a\right) \cdot c\right)}}{3 \cdot a} \]
      12. metadata-eval62.8%

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

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

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

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

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

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

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

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

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

    if 4.8e97 < b

    1. Initial program 6.5%

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

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

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot b\right) \cdot \left(2 + -1.5 \cdot \frac{a \cdot c}{{b}^{2}}\right)}}{3 \cdot a} \]
      2. mul-1-neg1.7%

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

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

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

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

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

Alternative 15: 10.4% accurate, 23.2× speedup?

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

\\
\frac{c}{b} \cdot 0.5
\end{array}
Derivation
  1. Initial program 50.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 33.7%

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

      \[\leadsto \frac{\color{blue}{\left(-1 \cdot b\right) \cdot \left(2 + -1.5 \cdot \frac{a \cdot c}{{b}^{2}}\right)}}{3 \cdot a} \]
    2. mul-1-neg33.7%

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

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

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

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

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

Reproduce

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