Cubic critical

Percentage Accurate: 51.6% → 83.5%
Time: 14.8s
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: 51.6% 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: 83.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.65 \cdot 10^{+87}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-127}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 9.5 \cdot 10^{-59}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \mathbf{elif}\;b \leq 6 \cdot 10^{-14}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{+59}:\\ \;\;\;\;c \cdot \left(c \cdot \left(-0.5625 \cdot \frac{c \cdot {a}^{2}}{{b}^{5}} + -0.375 \cdot \frac{a}{{b}^{3}}\right) + 0.5 \cdot \frac{-1}{b}\right)\\ \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+87)
   (+ (* -0.6666666666666666 (/ b a)) (* 0.5 (/ c b)))
   (if (<= b 4e-127)
     (/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))
     (if (<= b 9.5e-59)
       (* (/ c b) -0.5)
       (if (<= b 6e-14)
         (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
         (if (<= b 2e+59)
           (*
            c
            (+
             (*
              c
              (+
               (* -0.5625 (/ (* c (pow a 2.0)) (pow b 5.0)))
               (* -0.375 (/ a (pow b 3.0)))))
             (* 0.5 (/ -1.0 b))))
           (* 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+87) {
		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
	} else if (b <= 4e-127) {
		tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
	} else if (b <= 9.5e-59) {
		tmp = (c / b) * -0.5;
	} else if (b <= 6e-14) {
		tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	} else if (b <= 2e+59) {
		tmp = c * ((c * ((-0.5625 * ((c * pow(a, 2.0)) / pow(b, 5.0))) + (-0.375 * (a / pow(b, 3.0))))) + (0.5 * (-1.0 / b)));
	} 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+87)) then
        tmp = ((-0.6666666666666666d0) * (b / a)) + (0.5d0 * (c / b))
    else if (b <= 4d-127) then
        tmp = (sqrt(((b * b) - (3.0d0 * (a * c)))) - b) / (a * 3.0d0)
    else if (b <= 9.5d-59) then
        tmp = (c / b) * (-0.5d0)
    else if (b <= 6d-14) then
        tmp = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
    else if (b <= 2d+59) then
        tmp = c * ((c * (((-0.5625d0) * ((c * (a ** 2.0d0)) / (b ** 5.0d0))) + ((-0.375d0) * (a / (b ** 3.0d0))))) + (0.5d0 * ((-1.0d0) / b)))
    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+87) {
		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
	} else if (b <= 4e-127) {
		tmp = (Math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
	} else if (b <= 9.5e-59) {
		tmp = (c / b) * -0.5;
	} else if (b <= 6e-14) {
		tmp = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	} else if (b <= 2e+59) {
		tmp = c * ((c * ((-0.5625 * ((c * Math.pow(a, 2.0)) / Math.pow(b, 5.0))) + (-0.375 * (a / Math.pow(b, 3.0))))) + (0.5 * (-1.0 / b)));
	} 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+87:
		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b))
	elif b <= 4e-127:
		tmp = (math.sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0)
	elif b <= 9.5e-59:
		tmp = (c / b) * -0.5
	elif b <= 6e-14:
		tmp = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)
	elif b <= 2e+59:
		tmp = c * ((c * ((-0.5625 * ((c * math.pow(a, 2.0)) / math.pow(b, 5.0))) + (-0.375 * (a / math.pow(b, 3.0))))) + (0.5 * (-1.0 / b)))
	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+87)
		tmp = Float64(Float64(-0.6666666666666666 * Float64(b / a)) + Float64(0.5 * Float64(c / b)));
	elseif (b <= 4e-127)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0));
	elseif (b <= 9.5e-59)
		tmp = Float64(Float64(c / b) * -0.5);
	elseif (b <= 6e-14)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0));
	elseif (b <= 2e+59)
		tmp = Float64(c * Float64(Float64(c * Float64(Float64(-0.5625 * Float64(Float64(c * (a ^ 2.0)) / (b ^ 5.0))) + Float64(-0.375 * Float64(a / (b ^ 3.0))))) + Float64(0.5 * Float64(-1.0 / b))));
	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+87)
		tmp = (-0.6666666666666666 * (b / a)) + (0.5 * (c / b));
	elseif (b <= 4e-127)
		tmp = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
	elseif (b <= 9.5e-59)
		tmp = (c / b) * -0.5;
	elseif (b <= 6e-14)
		tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	elseif (b <= 2e+59)
		tmp = c * ((c * ((-0.5625 * ((c * (a ^ 2.0)) / (b ^ 5.0))) + (-0.375 * (a / (b ^ 3.0))))) + (0.5 * (-1.0 / b)));
	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+87], N[(N[(-0.6666666666666666 * N[(b / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4e-127], 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], If[LessEqual[b, 9.5e-59], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[b, 6e-14], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2e+59], N[(c * N[(N[(c * N[(N[(-0.5625 * N[(N[(c * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.375 * N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $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^{+87}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\

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

\mathbf{elif}\;b \leq 9.5 \cdot 10^{-59}:\\
\;\;\;\;\frac{c}{b} \cdot -0.5\\

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

\mathbf{elif}\;b \leq 2 \cdot 10^{+59}:\\
\;\;\;\;c \cdot \left(c \cdot \left(-0.5625 \cdot \frac{c \cdot {a}^{2}}{{b}^{5}} + -0.375 \cdot \frac{a}{{b}^{3}}\right) + 0.5 \cdot \frac{-1}{b}\right)\\

\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 6 regimes
  2. if b < -1.6500000000000001e87

    1. Initial program 49.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-neg49.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-neg49.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*49.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified49.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. Step-by-step derivation
      1. frac-2neg49.0%

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

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

      \[\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. un-div-inv49.0%

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

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

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

        \[\leadsto \frac{b - \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}{a \cdot -3} \]
    8. Applied egg-rr52.6%

      \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a \cdot -3}} \]
    9. Step-by-step derivation
      1. *-rgt-identity52.6%

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

        \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot \frac{1}{-3}} \]
      3. metadata-eval51.2%

        \[\leadsto \frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot \color{blue}{-0.3333333333333333} \]
    10. Simplified51.2%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)\right)} \cdot -0.3333333333333333 \]
    12. Step-by-step derivation
      1. mul-1-neg0.0%

        \[\leadsto \color{blue}{\left(-b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)} \cdot -0.3333333333333333 \]
      2. *-commutative0.0%

        \[\leadsto \left(-\color{blue}{\left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot b}\right) \cdot -0.3333333333333333 \]
      3. distribute-rgt-neg-in0.0%

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

        \[\leadsto \left(\left(-0.5 \cdot \frac{c \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot \left(-b\right)\right) \cdot -0.3333333333333333 \]
      5. rem-square-sqrt89.8%

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

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

        \[\leadsto \left(\left(-0.5 \cdot \frac{c \cdot -3}{{b}^{2}} - \frac{\color{blue}{2}}{a}\right) \cdot \left(-b\right)\right) \cdot -0.3333333333333333 \]
    13. Simplified89.8%

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

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

    if -1.6500000000000001e87 < b < 4.0000000000000001e-127

    1. Initial program 84.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-neg84.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-neg84.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*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

    if 4.0000000000000001e-127 < b < 9.4999999999999994e-59

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

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

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

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

    if 9.4999999999999994e-59 < b < 5.9999999999999997e-14

    1. Initial program 75.7%

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

    if 5.9999999999999997e-14 < b < 1.99999999999999994e59

    1. Initial program 23.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-neg23.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-neg23.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*23.9%

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

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

    if 1.99999999999999994e59 < b

    1. Initial program 12.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-neg12.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-neg12.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*12.4%

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

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

        \[\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/90.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.65 \cdot 10^{+87}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-127}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 9.5 \cdot 10^{-59}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \mathbf{elif}\;b \leq 6 \cdot 10^{-14}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{+59}:\\ \;\;\;\;c \cdot \left(c \cdot \left(-0.5625 \cdot \frac{c \cdot {a}^{2}}{{b}^{5}} + -0.375 \cdot \frac{a}{{b}^{3}}\right) + 0.5 \cdot \frac{-1}{b}\right)\\ \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.9% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 49.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-neg49.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-neg49.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*49.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified49.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. Step-by-step derivation
      1. frac-2neg49.0%

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

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

      \[\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. un-div-inv49.0%

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

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

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

        \[\leadsto \frac{b - \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}{a \cdot -3} \]
    8. Applied egg-rr52.6%

      \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a \cdot -3}} \]
    9. Step-by-step derivation
      1. *-rgt-identity52.6%

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

        \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot \frac{1}{-3}} \]
      3. metadata-eval51.2%

        \[\leadsto \frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot \color{blue}{-0.3333333333333333} \]
    10. Simplified51.2%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)\right)} \cdot -0.3333333333333333 \]
    12. Step-by-step derivation
      1. mul-1-neg0.0%

        \[\leadsto \color{blue}{\left(-b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)} \cdot -0.3333333333333333 \]
      2. *-commutative0.0%

        \[\leadsto \left(-\color{blue}{\left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot b}\right) \cdot -0.3333333333333333 \]
      3. distribute-rgt-neg-in0.0%

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

        \[\leadsto \left(\left(-0.5 \cdot \frac{c \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot \left(-b\right)\right) \cdot -0.3333333333333333 \]
      5. rem-square-sqrt89.8%

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

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

        \[\leadsto \left(\left(-0.5 \cdot \frac{c \cdot -3}{{b}^{2}} - \frac{\color{blue}{2}}{a}\right) \cdot \left(-b\right)\right) \cdot -0.3333333333333333 \]
    13. Simplified89.8%

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

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

    if -1.7000000000000001e87 < b < 4.0000000000000001e-127

    1. Initial program 84.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-neg84.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-neg84.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*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

    if 4.0000000000000001e-127 < b

    1. Initial program 22.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-neg22.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-neg22.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*22.4%

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

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

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

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

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

Alternative 3: 79.6% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 57.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-neg57.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-neg57.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*57.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified57.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. Step-by-step derivation
      1. frac-2neg57.4%

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

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

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

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

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

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

        \[\leadsto \frac{b - \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}{a \cdot -3} \]
    8. Applied egg-rr50.9%

      \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a \cdot -3}} \]
    9. Step-by-step derivation
      1. *-rgt-identity50.9%

        \[\leadsto \frac{\color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot 1}}{a \cdot -3} \]
      2. times-frac49.8%

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

        \[\leadsto \frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot \color{blue}{-0.3333333333333333} \]
    10. Simplified49.8%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)\right)} \cdot -0.3333333333333333 \]
    12. Step-by-step derivation
      1. mul-1-neg0.0%

        \[\leadsto \color{blue}{\left(-b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)} \cdot -0.3333333333333333 \]
      2. *-commutative0.0%

        \[\leadsto \left(-\color{blue}{\left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot b}\right) \cdot -0.3333333333333333 \]
      3. distribute-rgt-neg-in0.0%

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

        \[\leadsto \left(\left(-0.5 \cdot \frac{c \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot \left(-b\right)\right) \cdot -0.3333333333333333 \]
      5. rem-square-sqrt86.5%

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

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

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

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

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

    if -0.14499999999999999 < b < 4.0000000000000001e-127

    1. Initial program 83.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-neg83.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-neg83.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*83.2%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified83.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. Step-by-step derivation
      1. frac-2neg83.2%

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

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

      \[\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. Taylor expanded in b around 0 75.8%

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

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

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

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

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

    if 4.0000000000000001e-127 < b

    1. Initial program 22.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-neg22.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-neg22.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*22.4%

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

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

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

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

Alternative 4: 79.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 57.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-neg57.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-neg57.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*57.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified57.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. Step-by-step derivation
      1. frac-2neg57.4%

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

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

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

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

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

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

        \[\leadsto \frac{b - \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}{a \cdot -3} \]
    8. Applied egg-rr50.9%

      \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a \cdot -3}} \]
    9. Step-by-step derivation
      1. *-rgt-identity50.9%

        \[\leadsto \frac{\color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot 1}}{a \cdot -3} \]
      2. times-frac49.8%

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

        \[\leadsto \frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot \color{blue}{-0.3333333333333333} \]
    10. Simplified49.8%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)\right)} \cdot -0.3333333333333333 \]
    12. Step-by-step derivation
      1. mul-1-neg0.0%

        \[\leadsto \color{blue}{\left(-b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)} \cdot -0.3333333333333333 \]
      2. *-commutative0.0%

        \[\leadsto \left(-\color{blue}{\left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot b}\right) \cdot -0.3333333333333333 \]
      3. distribute-rgt-neg-in0.0%

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

        \[\leadsto \left(\left(-0.5 \cdot \frac{c \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot \left(-b\right)\right) \cdot -0.3333333333333333 \]
      5. rem-square-sqrt86.5%

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

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

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

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

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

    if -2.9499999999999999e-5 < b < 4.0000000000000001e-127

    1. Initial program 83.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-neg83.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-neg83.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*83.2%

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

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

    if 4.0000000000000001e-127 < b

    1. Initial program 22.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-neg22.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-neg22.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*22.4%

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

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

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

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

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

Alternative 5: 79.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 57.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-neg57.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-neg57.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*57.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified57.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. Step-by-step derivation
      1. frac-2neg57.4%

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

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

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

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

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

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

        \[\leadsto \frac{b - \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}{a \cdot -3} \]
    8. Applied egg-rr50.9%

      \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a \cdot -3}} \]
    9. Step-by-step derivation
      1. *-rgt-identity50.9%

        \[\leadsto \frac{\color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot 1}}{a \cdot -3} \]
      2. times-frac49.8%

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

        \[\leadsto \frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot \color{blue}{-0.3333333333333333} \]
    10. Simplified49.8%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)\right)} \cdot -0.3333333333333333 \]
    12. Step-by-step derivation
      1. mul-1-neg0.0%

        \[\leadsto \color{blue}{\left(-b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)} \cdot -0.3333333333333333 \]
      2. *-commutative0.0%

        \[\leadsto \left(-\color{blue}{\left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot b}\right) \cdot -0.3333333333333333 \]
      3. distribute-rgt-neg-in0.0%

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

        \[\leadsto \left(\left(-0.5 \cdot \frac{c \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot \left(-b\right)\right) \cdot -0.3333333333333333 \]
      5. rem-square-sqrt86.5%

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

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

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

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

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

    if -3.10000000000000014e-5 < b < 2.9999999999999998e-129

    1. Initial program 83.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-neg83.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-neg83.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*83.2%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified83.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. Step-by-step derivation
      1. frac-2neg83.2%

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

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

      \[\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. Taylor expanded in b around 0 75.8%

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

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

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

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

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

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

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

    if 2.9999999999999998e-129 < b

    1. Initial program 22.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-neg22.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-neg22.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*22.4%

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

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

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

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

Alternative 6: 79.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 57.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-neg57.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-neg57.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*57.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified57.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. Step-by-step derivation
      1. frac-2neg57.4%

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

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

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

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

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

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

        \[\leadsto \frac{b - \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}{a \cdot -3} \]
    8. Applied egg-rr50.9%

      \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a \cdot -3}} \]
    9. Step-by-step derivation
      1. *-rgt-identity50.9%

        \[\leadsto \frac{\color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot 1}}{a \cdot -3} \]
      2. times-frac49.8%

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

        \[\leadsto \frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot \color{blue}{-0.3333333333333333} \]
    10. Simplified49.8%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)\right)} \cdot -0.3333333333333333 \]
    12. Step-by-step derivation
      1. mul-1-neg0.0%

        \[\leadsto \color{blue}{\left(-b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)} \cdot -0.3333333333333333 \]
      2. *-commutative0.0%

        \[\leadsto \left(-\color{blue}{\left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot b}\right) \cdot -0.3333333333333333 \]
      3. distribute-rgt-neg-in0.0%

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

        \[\leadsto \left(\left(-0.5 \cdot \frac{c \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot \left(-b\right)\right) \cdot -0.3333333333333333 \]
      5. rem-square-sqrt86.5%

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

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

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

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

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

    if -0.012 < b < 1.4e-127

    1. Initial program 83.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-neg83.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-neg83.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*83.2%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified83.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. Step-by-step derivation
      1. frac-2neg83.2%

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

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

      \[\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. Taylor expanded in b around 0 75.8%

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(b - \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{1}{a \cdot -3}\right)}^{1}} \]
      2. un-div-inv75.9%

        \[\leadsto {\color{blue}{\left(\frac{b - \sqrt{c \cdot \left(a \cdot -3\right)}}{a \cdot -3}\right)}}^{1} \]
      3. *-un-lft-identity75.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e-127 < b

    1. Initial program 22.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-neg22.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-neg22.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*22.4%

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

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

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

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

Alternative 7: 79.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 57.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-neg57.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-neg57.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*57.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified57.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. Step-by-step derivation
      1. frac-2neg57.4%

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

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

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

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

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

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

        \[\leadsto \frac{b - \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}{a \cdot -3} \]
    8. Applied egg-rr50.9%

      \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a \cdot -3}} \]
    9. Step-by-step derivation
      1. *-rgt-identity50.9%

        \[\leadsto \frac{\color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot 1}}{a \cdot -3} \]
      2. times-frac49.8%

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

        \[\leadsto \frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot \color{blue}{-0.3333333333333333} \]
    10. Simplified49.8%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)\right)} \cdot -0.3333333333333333 \]
    12. Step-by-step derivation
      1. mul-1-neg0.0%

        \[\leadsto \color{blue}{\left(-b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)} \cdot -0.3333333333333333 \]
      2. *-commutative0.0%

        \[\leadsto \left(-\color{blue}{\left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot b}\right) \cdot -0.3333333333333333 \]
      3. distribute-rgt-neg-in0.0%

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

        \[\leadsto \left(\left(-0.5 \cdot \frac{c \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot \left(-b\right)\right) \cdot -0.3333333333333333 \]
      5. rem-square-sqrt86.5%

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

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

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

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

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

    if -1.18e-4 < b < 1.4e-127

    1. Initial program 83.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-neg83.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-neg83.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*83.2%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified83.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. Step-by-step derivation
      1. frac-2neg83.2%

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

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

      \[\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. Taylor expanded in b around 0 75.8%

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

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

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

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

      \[\leadsto \left(b - \sqrt{\color{blue}{c \cdot \left(a \cdot -3\right)}}\right) \cdot \frac{1}{a \cdot -3} \]
    10. Taylor expanded in a around 0 75.7%

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

    if 1.4e-127 < b

    1. Initial program 22.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-neg22.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-neg22.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*22.4%

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

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

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

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

Alternative 8: 79.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 57.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-neg57.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-neg57.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*57.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified57.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. Step-by-step derivation
      1. frac-2neg57.4%

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

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

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

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

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

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

        \[\leadsto \frac{b - \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}{a \cdot -3} \]
    8. Applied egg-rr50.9%

      \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a \cdot -3}} \]
    9. Step-by-step derivation
      1. *-rgt-identity50.9%

        \[\leadsto \frac{\color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot 1}}{a \cdot -3} \]
      2. times-frac49.8%

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

        \[\leadsto \frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot \color{blue}{-0.3333333333333333} \]
    10. Simplified49.8%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)\right)} \cdot -0.3333333333333333 \]
    12. Step-by-step derivation
      1. mul-1-neg0.0%

        \[\leadsto \color{blue}{\left(-b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)} \cdot -0.3333333333333333 \]
      2. *-commutative0.0%

        \[\leadsto \left(-\color{blue}{\left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot b}\right) \cdot -0.3333333333333333 \]
      3. distribute-rgt-neg-in0.0%

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

        \[\leadsto \left(\left(-0.5 \cdot \frac{c \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot \left(-b\right)\right) \cdot -0.3333333333333333 \]
      5. rem-square-sqrt86.5%

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

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

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

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

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

    if -3.10000000000000014e-5 < b < 7.0000000000000004e-131

    1. Initial program 83.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-neg83.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-neg83.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*83.2%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified83.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. Step-by-step derivation
      1. frac-2neg83.2%

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

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

      \[\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. Taylor expanded in b around 0 75.8%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b - \sqrt{a \cdot -3} \cdot \sqrt{c}}{a \cdot -3}} \]
      2. *-commutative42.2%

        \[\leadsto \frac{b - \color{blue}{\sqrt{c} \cdot \sqrt{a \cdot -3}}}{a \cdot -3} \]
      3. sqrt-prod75.9%

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

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

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

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

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

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

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

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

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

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

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

    if 7.0000000000000004e-131 < b

    1. Initial program 22.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-neg22.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-neg22.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*22.4%

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

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

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

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

Alternative 9: 68.1% accurate, 7.2× speedup?

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

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

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


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

    1. Initial program 66.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-neg66.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-neg66.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*66.6%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified66.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-2neg66.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-inv66.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-rr66.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. un-div-inv66.6%

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

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

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

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

      \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a \cdot -3}} \]
    9. Step-by-step derivation
      1. *-rgt-identity62.0%

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

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

        \[\leadsto \frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot \color{blue}{-0.3333333333333333} \]
    10. Simplified61.1%

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

      \[\leadsto \color{blue}{\left(-1 \cdot \left(b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)\right)} \cdot -0.3333333333333333 \]
    12. Step-by-step derivation
      1. mul-1-neg0.0%

        \[\leadsto \color{blue}{\left(-b \cdot \left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right)\right)} \cdot -0.3333333333333333 \]
      2. *-commutative0.0%

        \[\leadsto \left(-\color{blue}{\left(-0.5 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot b}\right) \cdot -0.3333333333333333 \]
      3. distribute-rgt-neg-in0.0%

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

        \[\leadsto \left(\left(-0.5 \cdot \frac{c \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{{b}^{2}} - 2 \cdot \frac{1}{a}\right) \cdot \left(-b\right)\right) \cdot -0.3333333333333333 \]
      5. rem-square-sqrt65.1%

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

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

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

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

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

    if -5.00000000000023e-311 < b

    1. Initial program 35.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-neg35.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-neg35.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*35.4%

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

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

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

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

Alternative 10: 68.0% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 66.9%

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified66.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. Step-by-step derivation
      1. frac-2neg66.9%

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

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

      \[\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. Taylor expanded in b around -inf 66.3%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    11. Applied egg-rr66.5%

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

    if 3.6000000000000001e-295 < b

    1. Initial program 34.9%

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

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

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

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

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

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

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

Alternative 11: 68.0% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 66.9%

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

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

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

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

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

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

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

    if 2.09999999999999993e-295 < b

    1. Initial program 34.9%

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

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

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

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

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

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

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

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

Alternative 12: 67.9% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 66.9%

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

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

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

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

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

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

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

    if 2.09999999999999993e-295 < b

    1. Initial program 34.9%

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified34.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. Step-by-step derivation
      1. frac-2neg34.9%

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

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

      \[\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. un-div-inv34.9%

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

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

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

        \[\leadsto \frac{b - \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}{a \cdot -3} \]
    8. Applied egg-rr42.9%

      \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a \cdot -3}} \]
    9. Step-by-step derivation
      1. *-rgt-identity42.9%

        \[\leadsto \frac{\color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot 1}}{a \cdot -3} \]
      2. times-frac42.8%

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

        \[\leadsto \frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot \color{blue}{-0.3333333333333333} \]
    10. Simplified42.8%

      \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot -0.3333333333333333} \]
    11. Step-by-step derivation
      1. associate-*l/42.8%

        \[\leadsto \color{blue}{\frac{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot -0.3333333333333333}{a}} \]
      2. clear-num42.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot -0.3333333333333333}}} \]
    12. Applied egg-rr42.8%

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

        \[\leadsto \color{blue}{\frac{1}{a} \cdot \left(\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot -0.3333333333333333\right)} \]
      2. *-commutative42.8%

        \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right)\right)} \]
    14. Simplified42.8%

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{b}} \]
    16. Step-by-step derivation
      1. *-commutative0.0%

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

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

        \[\leadsto \color{blue}{c \cdot \left(\frac{{\left(\sqrt{-3}\right)}^{2}}{b} \cdot 0.16666666666666666\right)} \]
      4. *-commutative0.0%

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

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

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

        \[\leadsto c \cdot \frac{0.16666666666666666 \cdot \color{blue}{-3}}{b} \]
      8. metadata-eval65.0%

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

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

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

Alternative 13: 67.9% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 66.9%

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified66.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. Step-by-step derivation
      1. frac-2neg66.9%

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

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

      \[\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. Taylor expanded in b around -inf 66.3%

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

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

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

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

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

    if 2.09999999999999993e-295 < b

    1. Initial program 34.9%

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified34.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. Step-by-step derivation
      1. frac-2neg34.9%

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

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

      \[\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. un-div-inv34.9%

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

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

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

        \[\leadsto \frac{b - \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}}{a \cdot -3} \]
    8. Applied egg-rr42.9%

      \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a \cdot -3}} \]
    9. Step-by-step derivation
      1. *-rgt-identity42.9%

        \[\leadsto \frac{\color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot 1}}{a \cdot -3} \]
      2. times-frac42.8%

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

        \[\leadsto \frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot \color{blue}{-0.3333333333333333} \]
    10. Simplified42.8%

      \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a} \cdot -0.3333333333333333} \]
    11. Step-by-step derivation
      1. associate-*l/42.8%

        \[\leadsto \color{blue}{\frac{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot -0.3333333333333333}{a}} \]
      2. clear-num42.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot -0.3333333333333333}}} \]
    12. Applied egg-rr42.8%

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

        \[\leadsto \color{blue}{\frac{1}{a} \cdot \left(\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot -0.3333333333333333\right)} \]
      2. *-commutative42.8%

        \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(-0.3333333333333333 \cdot \left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right)\right)} \]
    14. Simplified42.8%

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{b}} \]
    16. Step-by-step derivation
      1. *-commutative0.0%

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

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

        \[\leadsto \color{blue}{c \cdot \left(\frac{{\left(\sqrt{-3}\right)}^{2}}{b} \cdot 0.16666666666666666\right)} \]
      4. *-commutative0.0%

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

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

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

        \[\leadsto c \cdot \frac{0.16666666666666666 \cdot \color{blue}{-3}}{b} \]
      8. metadata-eval65.0%

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

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

Alternative 14: 35.5% accurate, 23.2× speedup?

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

\\
b \cdot \frac{-0.6666666666666666}{a}
\end{array}
Derivation
  1. Initial program 50.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-neg50.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-neg50.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*50.4%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  3. Simplified50.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. Step-by-step derivation
    1. frac-2neg50.4%

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

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

    \[\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. Taylor expanded in b around -inf 33.4%

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

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

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

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

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

Reproduce

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