Cubic critical

Percentage Accurate: 52.2% → 84.5%
Time: 15.3s
Alternatives: 14
Speedup: 11.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 52.2% 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.5% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

    if -2.8999999999999998e152 < b < 1.7499999999999999e-82

    1. Initial program 88.2%

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

    if 1.7499999999999999e-82 < b

    1. Initial program 13.4%

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

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

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

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

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

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

        \[\leadsto c \cdot \left(-0.375 \cdot \color{blue}{\left(a \cdot \frac{c}{{b}^{3}}\right)} - 0.5 \cdot \frac{1}{b}\right) \]
      2. associate-*r/93.4%

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

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

      \[\leadsto \color{blue}{c \cdot \left(-0.375 \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) - \frac{0.5}{b}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.1%

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

Alternative 2: 84.5% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 39.0%

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

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

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

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

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

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

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

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

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

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

    if -5.2000000000000001e152 < b < 1.7499999999999999e-82

    1. Initial program 88.2%

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

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

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

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

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

    if 1.7499999999999999e-82 < b

    1. Initial program 13.4%

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

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

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

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

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

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

        \[\leadsto c \cdot \left(-0.375 \cdot \color{blue}{\left(a \cdot \frac{c}{{b}^{3}}\right)} - 0.5 \cdot \frac{1}{b}\right) \]
      2. associate-*r/93.4%

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

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

      \[\leadsto \color{blue}{c \cdot \left(-0.375 \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) - \frac{0.5}{b}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.0%

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

Alternative 3: 79.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.62 \cdot 10^{-83}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{-82}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(-0.375 \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) - \frac{0.5}{b}\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.62e-83)
   (* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
   (if (<= b 1.5e-82)
     (/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
     (* c (- (* -0.375 (* a (/ c (pow b 3.0)))) (/ 0.5 b))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.62e-83) {
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
	} else if (b <= 1.5e-82) {
		tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
	} else {
		tmp = c * ((-0.375 * (a * (c / pow(b, 3.0)))) - (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.62d-83)) then
        tmp = b * ((0.6666666666666666d0 * ((-1.0d0) / a)) - ((-0.5d0) * (c / (b ** 2.0d0))))
    else if (b <= 1.5d-82) then
        tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
    else
        tmp = c * (((-0.375d0) * (a * (c / (b ** 3.0d0)))) - (0.5d0 / b))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.62e-83) {
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
	} else if (b <= 1.5e-82) {
		tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
	} else {
		tmp = c * ((-0.375 * (a * (c / Math.pow(b, 3.0)))) - (0.5 / b));
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.62e-83:
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0))))
	elif b <= 1.5e-82:
		tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0)
	else:
		tmp = c * ((-0.375 * (a * (c / math.pow(b, 3.0)))) - (0.5 / b))
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.62e-83)
		tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0)))));
	elseif (b <= 1.5e-82)
		tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0));
	else
		tmp = Float64(c * Float64(Float64(-0.375 * Float64(a * Float64(c / (b ^ 3.0)))) - Float64(0.5 / b)));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.62e-83)
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0))));
	elseif (b <= 1.5e-82)
		tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
	else
		tmp = c * ((-0.375 * (a * (c / (b ^ 3.0)))) - (0.5 / b));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.62e-83], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.5e-82], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(-0.375 * N[(a * N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 67.6%

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

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

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

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

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

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

    if -1.6199999999999999e-83 < b < 1.4999999999999999e-82

    1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4999999999999999e-82 < b

    1. Initial program 13.4%

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

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

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

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

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

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

        \[\leadsto c \cdot \left(-0.375 \cdot \color{blue}{\left(a \cdot \frac{c}{{b}^{3}}\right)} - 0.5 \cdot \frac{1}{b}\right) \]
      2. associate-*r/93.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.62 \cdot 10^{-83}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{-82}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(-0.375 \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) - \frac{0.5}{b}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 79.3% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.65 \cdot 10^{-76}:\\
\;\;\;\;-0.3333333333333333 \cdot \left(b \cdot \left(\frac{2}{a} - \frac{c}{{b}^{2}} \cdot 1.5\right)\right)\\

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

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


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

    1. Initial program 67.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}\right)}}{3 \cdot a} \]
      9. times-frac67.6%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}{a}} \]
    9. Taylor expanded in b around -inf 88.8%

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

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

        \[\leadsto -0.3333333333333333 \cdot \left(\color{blue}{\left(-b\right)} \cdot \left(1.5 \cdot \frac{c}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right) \]
      3. associate-*r/88.8%

        \[\leadsto -0.3333333333333333 \cdot \left(\left(-b\right) \cdot \left(1.5 \cdot \frac{c}{{b}^{2}} - \color{blue}{\frac{2 \cdot 1}{a}}\right)\right) \]
      4. metadata-eval88.8%

        \[\leadsto -0.3333333333333333 \cdot \left(\left(-b\right) \cdot \left(1.5 \cdot \frac{c}{{b}^{2}} - \frac{\color{blue}{2}}{a}\right)\right) \]
    11. Simplified88.8%

      \[\leadsto -0.3333333333333333 \cdot \color{blue}{\left(\left(-b\right) \cdot \left(1.5 \cdot \frac{c}{{b}^{2}} - \frac{2}{a}\right)\right)} \]

    if -1.64999999999999992e-76 < b < 1.84999999999999997e-83

    1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.84999999999999997e-83 < b

    1. Initial program 13.4%

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

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

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

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

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

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

        \[\leadsto c \cdot \left(-0.375 \cdot \color{blue}{\left(a \cdot \frac{c}{{b}^{3}}\right)} - 0.5 \cdot \frac{1}{b}\right) \]
      2. associate-*r/93.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.65 \cdot 10^{-76}:\\ \;\;\;\;-0.3333333333333333 \cdot \left(b \cdot \left(\frac{2}{a} - \frac{c}{{b}^{2}} \cdot 1.5\right)\right)\\ \mathbf{elif}\;b \leq 1.85 \cdot 10^{-83}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(-0.375 \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) - \frac{0.5}{b}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 79.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.35 \cdot 10^{-77}:\\ \;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-83}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(-0.375 \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) - \frac{0.5}{b}\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.35e-77)
   (/ (* b -2.0) (* a 3.0))
   (if (<= b 2.4e-83)
     (/ (- (sqrt (* c (* a -3.0))) b) (* a 3.0))
     (* c (- (* -0.375 (* a (/ c (pow b 3.0)))) (/ 0.5 b))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.35e-77) {
		tmp = (b * -2.0) / (a * 3.0);
	} else if (b <= 2.4e-83) {
		tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
	} else {
		tmp = c * ((-0.375 * (a * (c / pow(b, 3.0)))) - (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.35d-77)) then
        tmp = (b * (-2.0d0)) / (a * 3.0d0)
    else if (b <= 2.4d-83) then
        tmp = (sqrt((c * (a * (-3.0d0)))) - b) / (a * 3.0d0)
    else
        tmp = c * (((-0.375d0) * (a * (c / (b ** 3.0d0)))) - (0.5d0 / b))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.35e-77) {
		tmp = (b * -2.0) / (a * 3.0);
	} else if (b <= 2.4e-83) {
		tmp = (Math.sqrt((c * (a * -3.0))) - b) / (a * 3.0);
	} else {
		tmp = c * ((-0.375 * (a * (c / Math.pow(b, 3.0)))) - (0.5 / b));
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.35e-77:
		tmp = (b * -2.0) / (a * 3.0)
	elif b <= 2.4e-83:
		tmp = (math.sqrt((c * (a * -3.0))) - b) / (a * 3.0)
	else:
		tmp = c * ((-0.375 * (a * (c / math.pow(b, 3.0)))) - (0.5 / b))
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.35e-77)
		tmp = Float64(Float64(b * -2.0) / Float64(a * 3.0));
	elseif (b <= 2.4e-83)
		tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -3.0))) - b) / Float64(a * 3.0));
	else
		tmp = Float64(c * Float64(Float64(-0.375 * Float64(a * Float64(c / (b ^ 3.0)))) - Float64(0.5 / b)));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.35e-77)
		tmp = (b * -2.0) / (a * 3.0);
	elseif (b <= 2.4e-83)
		tmp = (sqrt((c * (a * -3.0))) - b) / (a * 3.0);
	else
		tmp = c * ((-0.375 * (a * (c / (b ^ 3.0)))) - (0.5 / b));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.35e-77], N[(N[(b * -2.0), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.4e-83], N[(N[(N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(-0.375 * N[(a * N[(c / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 67.6%

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

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

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

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

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

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

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

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

    if -1.35e-77 < b < 2.4000000000000001e-83

    1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.4000000000000001e-83 < b

    1. Initial program 13.4%

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

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

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

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

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

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

        \[\leadsto c \cdot \left(-0.375 \cdot \color{blue}{\left(a \cdot \frac{c}{{b}^{3}}\right)} - 0.5 \cdot \frac{1}{b}\right) \]
      2. associate-*r/93.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.35 \cdot 10^{-77}:\\ \;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-83}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(-0.375 \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) - \frac{0.5}{b}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 79.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 67.6%

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

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

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

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

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

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

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

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

    if -1.2499999999999999e-72 < b < 1.22000000000000001e-82

    1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.22000000000000001e-82 < b

    1. Initial program 13.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 78.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 68.2%

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

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

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

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

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

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

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

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

    if -1.89999999999999999e-140 < b < 1.3e-82

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.3e-82 < b

    1. Initial program 13.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 67.0% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 73.3%

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 32.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 67.0% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 73.3%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b \cdot -0.6666666666666666}{a}} \]
    9. Applied egg-rr67.4%

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

    if -4.999999999999985e-310 < b

    1. Initial program 32.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 67.0% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 73.3%

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 32.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 67.0% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 73.3%

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 32.0%

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

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

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

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

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

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

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

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

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

Alternative 12: 42.4% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 72.3%

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

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

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

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

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

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

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

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

    if 660 < b

    1. Initial program 10.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-\frac{a \cdot \left(c \cdot -1.5\right)}{b}}{-3 \cdot a}} \]
      2. div-inv80.3%

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

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

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

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

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

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

        \[\leadsto \frac{a \cdot \left(c \cdot -1.5\right)}{\color{blue}{b}} \cdot \frac{1}{-3 \cdot a} \]
      9. associate-/l*34.0%

        \[\leadsto \color{blue}{\left(a \cdot \frac{c \cdot -1.5}{b}\right)} \cdot \frac{1}{-3 \cdot a} \]
      10. *-commutative34.0%

        \[\leadsto \left(a \cdot \frac{\color{blue}{-1.5 \cdot c}}{b}\right) \cdot \frac{1}{-3 \cdot a} \]
      11. *-un-lft-identity34.0%

        \[\leadsto \left(a \cdot \frac{-1.5 \cdot c}{\color{blue}{1 \cdot b}}\right) \cdot \frac{1}{-3 \cdot a} \]
      12. times-frac34.0%

        \[\leadsto \left(a \cdot \color{blue}{\left(\frac{-1.5}{1} \cdot \frac{c}{b}\right)}\right) \cdot \frac{1}{-3 \cdot a} \]
      13. metadata-eval34.0%

        \[\leadsto \left(a \cdot \left(\color{blue}{-1.5} \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{-3 \cdot a} \]
      14. distribute-lft-neg-in34.0%

        \[\leadsto \left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{\left(-3\right) \cdot a}} \]
      15. metadata-eval34.0%

        \[\leadsto \left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{-3} \cdot a} \]
      16. *-commutative34.0%

        \[\leadsto \left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{a \cdot -3}} \]
    9. Applied egg-rr34.0%

      \[\leadsto \color{blue}{\left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{a \cdot -3}} \]
    10. Step-by-step derivation
      1. associate-*r/34.0%

        \[\leadsto \color{blue}{\frac{\left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot 1}{a \cdot -3}} \]
      2. *-rgt-identity34.0%

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

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

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

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

        \[\leadsto \left(\frac{\color{blue}{1}}{-3} \cdot -1.5\right) \cdot \frac{c}{b} \]
      7. metadata-eval33.8%

        \[\leadsto \left(\color{blue}{-0.3333333333333333} \cdot -1.5\right) \cdot \frac{c}{b} \]
      8. metadata-eval33.8%

        \[\leadsto \color{blue}{0.5} \cdot \frac{c}{b} \]
    11. Simplified33.8%

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

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

Alternative 13: 42.4% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 72.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.19999999999999977e-5 < b

    1. Initial program 10.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-\frac{a \cdot \left(c \cdot -1.5\right)}{b}}{-3 \cdot a}} \]
      2. div-inv80.3%

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

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

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

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

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

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

        \[\leadsto \frac{a \cdot \left(c \cdot -1.5\right)}{\color{blue}{b}} \cdot \frac{1}{-3 \cdot a} \]
      9. associate-/l*34.0%

        \[\leadsto \color{blue}{\left(a \cdot \frac{c \cdot -1.5}{b}\right)} \cdot \frac{1}{-3 \cdot a} \]
      10. *-commutative34.0%

        \[\leadsto \left(a \cdot \frac{\color{blue}{-1.5 \cdot c}}{b}\right) \cdot \frac{1}{-3 \cdot a} \]
      11. *-un-lft-identity34.0%

        \[\leadsto \left(a \cdot \frac{-1.5 \cdot c}{\color{blue}{1 \cdot b}}\right) \cdot \frac{1}{-3 \cdot a} \]
      12. times-frac34.0%

        \[\leadsto \left(a \cdot \color{blue}{\left(\frac{-1.5}{1} \cdot \frac{c}{b}\right)}\right) \cdot \frac{1}{-3 \cdot a} \]
      13. metadata-eval34.0%

        \[\leadsto \left(a \cdot \left(\color{blue}{-1.5} \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{-3 \cdot a} \]
      14. distribute-lft-neg-in34.0%

        \[\leadsto \left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{\left(-3\right) \cdot a}} \]
      15. metadata-eval34.0%

        \[\leadsto \left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{-3} \cdot a} \]
      16. *-commutative34.0%

        \[\leadsto \left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{a \cdot -3}} \]
    9. Applied egg-rr34.0%

      \[\leadsto \color{blue}{\left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{a \cdot -3}} \]
    10. Step-by-step derivation
      1. associate-*r/34.0%

        \[\leadsto \color{blue}{\frac{\left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot 1}{a \cdot -3}} \]
      2. *-rgt-identity34.0%

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

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

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

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

        \[\leadsto \left(\frac{\color{blue}{1}}{-3} \cdot -1.5\right) \cdot \frac{c}{b} \]
      7. metadata-eval33.8%

        \[\leadsto \left(\color{blue}{-0.3333333333333333} \cdot -1.5\right) \cdot \frac{c}{b} \]
      8. metadata-eval33.8%

        \[\leadsto \color{blue}{0.5} \cdot \frac{c}{b} \]
    11. Simplified33.8%

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

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

Alternative 14: 10.0% accurate, 23.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-\frac{a \cdot \left(c \cdot -1.5\right)}{b}\right) \cdot \frac{1}{-3 \cdot a}} \]
    3. distribute-neg-frac228.0%

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

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

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

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

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

      \[\leadsto \frac{a \cdot \left(c \cdot -1.5\right)}{\color{blue}{b}} \cdot \frac{1}{-3 \cdot a} \]
    9. associate-/l*12.5%

      \[\leadsto \color{blue}{\left(a \cdot \frac{c \cdot -1.5}{b}\right)} \cdot \frac{1}{-3 \cdot a} \]
    10. *-commutative12.5%

      \[\leadsto \left(a \cdot \frac{\color{blue}{-1.5 \cdot c}}{b}\right) \cdot \frac{1}{-3 \cdot a} \]
    11. *-un-lft-identity12.5%

      \[\leadsto \left(a \cdot \frac{-1.5 \cdot c}{\color{blue}{1 \cdot b}}\right) \cdot \frac{1}{-3 \cdot a} \]
    12. times-frac12.5%

      \[\leadsto \left(a \cdot \color{blue}{\left(\frac{-1.5}{1} \cdot \frac{c}{b}\right)}\right) \cdot \frac{1}{-3 \cdot a} \]
    13. metadata-eval12.5%

      \[\leadsto \left(a \cdot \left(\color{blue}{-1.5} \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{-3 \cdot a} \]
    14. distribute-lft-neg-in12.5%

      \[\leadsto \left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{\left(-3\right) \cdot a}} \]
    15. metadata-eval12.5%

      \[\leadsto \left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{-3} \cdot a} \]
    16. *-commutative12.5%

      \[\leadsto \left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{\color{blue}{a \cdot -3}} \]
  9. Applied egg-rr12.5%

    \[\leadsto \color{blue}{\left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot \frac{1}{a \cdot -3}} \]
  10. Step-by-step derivation
    1. associate-*r/12.5%

      \[\leadsto \color{blue}{\frac{\left(a \cdot \left(-1.5 \cdot \frac{c}{b}\right)\right) \cdot 1}{a \cdot -3}} \]
    2. *-rgt-identity12.5%

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

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

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

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

      \[\leadsto \left(\frac{\color{blue}{1}}{-3} \cdot -1.5\right) \cdot \frac{c}{b} \]
    7. metadata-eval12.4%

      \[\leadsto \left(\color{blue}{-0.3333333333333333} \cdot -1.5\right) \cdot \frac{c}{b} \]
    8. metadata-eval12.4%

      \[\leadsto \color{blue}{0.5} \cdot \frac{c}{b} \]
  11. Simplified12.4%

    \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b}} \]
  12. Add Preprocessing

Reproduce

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