Cubic critical

Percentage Accurate: 51.6% → 83.9%
Time: 14.2s
Alternatives: 11
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 11 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.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c}{b} \cdot -0.5\\ t_1 := \frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\ \mathbf{if}\;b \leq -1.5 \cdot 10^{+87}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-127}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq 10^{-58}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 1.65 \cdot 10^{-13}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{+35}:\\ \;\;\;\;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}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* (/ c b) -0.5))
        (t_1 (/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))))
   (if (<= b -1.5e+87)
     (/ b (* a -1.5))
     (if (<= b 4e-127)
       t_1
       (if (<= b 1e-58)
         t_0
         (if (<= b 1.65e-13)
           t_1
           (if (<= b 1.55e+35)
             (*
              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))))
             t_0)))))))
double code(double a, double b, double c) {
	double t_0 = (c / b) * -0.5;
	double t_1 = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
	double tmp;
	if (b <= -1.5e+87) {
		tmp = b / (a * -1.5);
	} else if (b <= 4e-127) {
		tmp = t_1;
	} else if (b <= 1e-58) {
		tmp = t_0;
	} else if (b <= 1.65e-13) {
		tmp = t_1;
	} else if (b <= 1.55e+35) {
		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 = t_0;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (c / b) * (-0.5d0)
    t_1 = (sqrt(((b * b) - ((a * 3.0d0) * c))) - b) / (a * 3.0d0)
    if (b <= (-1.5d+87)) then
        tmp = b / (a * (-1.5d0))
    else if (b <= 4d-127) then
        tmp = t_1
    else if (b <= 1d-58) then
        tmp = t_0
    else if (b <= 1.65d-13) then
        tmp = t_1
    else if (b <= 1.55d+35) 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 = t_0
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = (c / b) * -0.5;
	double t_1 = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
	double tmp;
	if (b <= -1.5e+87) {
		tmp = b / (a * -1.5);
	} else if (b <= 4e-127) {
		tmp = t_1;
	} else if (b <= 1e-58) {
		tmp = t_0;
	} else if (b <= 1.65e-13) {
		tmp = t_1;
	} else if (b <= 1.55e+35) {
		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 = t_0;
	}
	return tmp;
}
def code(a, b, c):
	t_0 = (c / b) * -0.5
	t_1 = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0)
	tmp = 0
	if b <= -1.5e+87:
		tmp = b / (a * -1.5)
	elif b <= 4e-127:
		tmp = t_1
	elif b <= 1e-58:
		tmp = t_0
	elif b <= 1.65e-13:
		tmp = t_1
	elif b <= 1.55e+35:
		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 = t_0
	return tmp
function code(a, b, c)
	t_0 = Float64(Float64(c / b) * -0.5)
	t_1 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0))
	tmp = 0.0
	if (b <= -1.5e+87)
		tmp = Float64(b / Float64(a * -1.5));
	elseif (b <= 4e-127)
		tmp = t_1;
	elseif (b <= 1e-58)
		tmp = t_0;
	elseif (b <= 1.65e-13)
		tmp = t_1;
	elseif (b <= 1.55e+35)
		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 = t_0;
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = (c / b) * -0.5;
	t_1 = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
	tmp = 0.0;
	if (b <= -1.5e+87)
		tmp = b / (a * -1.5);
	elseif (b <= 4e-127)
		tmp = t_1;
	elseif (b <= 1e-58)
		tmp = t_0;
	elseif (b <= 1.65e-13)
		tmp = t_1;
	elseif (b <= 1.55e+35)
		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 = t_0;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 3.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.5e+87], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4e-127], t$95$1, If[LessEqual[b, 1e-58], t$95$0, If[LessEqual[b, 1.65e-13], t$95$1, If[LessEqual[b, 1.55e+35], 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], t$95$0]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 4 \cdot 10^{-127}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq 10^{-58}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;b \leq 1.65 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq 1.55 \cdot 10^{+35}:\\
\;\;\;\;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}:\\
\;\;\;\;t\_0\\


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

    1. Initial program 49.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    9. Step-by-step derivation
      1. clear-num91.0%

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr91.4%

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

    if -1.4999999999999999e87 < b < 4.0000000000000001e-127 or 1e-58 < b < 1.65e-13

    1. Initial program 83.6%

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

    if 4.0000000000000001e-127 < b < 1e-58 or 1.54999999999999993e35 < b

    1. Initial program 17.5%

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

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

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

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

    if 1.65e-13 < b < 1.54999999999999993e35

    1. Initial program 19.9%

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

      \[\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)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification86.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.5 \cdot 10^{+87}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-127}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 10^{-58}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \mathbf{elif}\;b \leq 1.65 \cdot 10^{-13}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{+35}:\\ \;\;\;\;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}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 84.9% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 49.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    9. Step-by-step derivation
      1. clear-num91.0%

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr91.4%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} \cdot -0.5} \]
    5. 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.5 \cdot 10^{+87}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-127}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 79.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -3.3 \cdot 10^{-5}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \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 -3.3e-5)
   (/ b (* a -1.5))
   (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 <= -3.3e-5) {
		tmp = b / (a * -1.5);
	} 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 <= (-3.3d-5)) then
        tmp = b / (a * (-1.5d0))
    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 <= -3.3e-5) {
		tmp = b / (a * -1.5);
	} 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 <= -3.3e-5:
		tmp = b / (a * -1.5)
	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 <= -3.3e-5)
		tmp = Float64(b / Float64(a * -1.5));
	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 <= -3.3e-5)
		tmp = b / (a * -1.5);
	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, -3.3e-5], N[(b / N[(a * -1.5), $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 -3.3 \cdot 10^{-5}:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\

\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 < -3.3000000000000003e-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. Add Preprocessing
    3. Applied egg-rr57.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr87.6%

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

    if -3.3000000000000003e-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. Add Preprocessing
    3. Step-by-step derivation
      1. prod-diff83.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{{b}^{2} + \left(a \cdot \left(c \cdot -3\right) + \color{blue}{\left(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(3 \cdot a\right) \cdot c\right)}\right)}}{3 \cdot a} \]
    4. Applied egg-rr82.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{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. Add Preprocessing
    3. Taylor expanded in b around inf 80.1%

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

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

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

Alternative 4: 79.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -0.0085:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-127}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -0.0085)
   (/ b (* a -1.5))
   (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 <= -0.0085) {
		tmp = b / (a * -1.5);
	} 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 <= (-0.0085d0)) then
        tmp = b / (a * (-1.5d0))
    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 <= -0.0085) {
		tmp = b / (a * -1.5);
	} 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 <= -0.0085:
		tmp = b / (a * -1.5)
	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 <= -0.0085)
		tmp = Float64(b / Float64(a * -1.5));
	elseif (b <= 4e-127)
		tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / Float64(a * 3.0));
	else
		tmp = Float64(Float64(c / b) * -0.5);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -0.0085)
		tmp = b / (a * -1.5);
	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, -0.0085], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4e-127], N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 57.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr87.6%

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

    if -0.0085000000000000006 < 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. Add Preprocessing
    3. Step-by-step derivation
      1. prod-diff83.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{{b}^{2} + \left(a \cdot \left(c \cdot -3\right) + \color{blue}{\left(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(3 \cdot a\right) \cdot c\right)}\right)}}{3 \cdot a} \]
    4. Applied egg-rr82.8%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\sqrt{a \cdot \left(c \cdot -3\right)} - b}}{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. Add Preprocessing
    3. Taylor expanded in b around inf 80.1%

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

        \[\leadsto \color{blue}{\frac{c}{b} \cdot -0.5} \]
    5. 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 -0.0085:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-127}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 79.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -0.000118:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 3.5 \cdot 10^{-127}:\\ \;\;\;\;\left(\sqrt{\left(a \cdot c\right) \cdot -3} - b\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)
   (/ b (* a -1.5))
   (if (<= b 3.5e-127)
     (* (- (sqrt (* (* a c) -3.0)) b) (/ 0.3333333333333333 a))
     (* (/ c b) -0.5))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -0.000118) {
		tmp = b / (a * -1.5);
	} else if (b <= 3.5e-127) {
		tmp = (sqrt(((a * c) * -3.0)) - b) * (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 = b / (a * (-1.5d0))
    else if (b <= 3.5d-127) then
        tmp = (sqrt(((a * c) * (-3.0d0))) - b) * (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 = b / (a * -1.5);
	} else if (b <= 3.5e-127) {
		tmp = (Math.sqrt(((a * c) * -3.0)) - b) * (0.3333333333333333 / a);
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -0.000118:
		tmp = b / (a * -1.5)
	elif b <= 3.5e-127:
		tmp = (math.sqrt(((a * c) * -3.0)) - b) * (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(b / Float64(a * -1.5));
	elseif (b <= 3.5e-127)
		tmp = Float64(Float64(sqrt(Float64(Float64(a * c) * -3.0)) - b) * 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 = b / (a * -1.5);
	elseif (b <= 3.5e-127)
		tmp = (sqrt(((a * c) * -3.0)) - b) * (0.3333333333333333 / a);
	else
		tmp = (c / b) * -0.5;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -0.000118], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.5e-127], N[(N[(N[Sqrt[N[(N[(a * c), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $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:\\
\;\;\;\;\frac{b}{a \cdot -1.5}\\

\mathbf{elif}\;b \leq 3.5 \cdot 10^{-127}:\\
\;\;\;\;\left(\sqrt{\left(a \cdot c\right) \cdot -3} - b\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. Add Preprocessing
    3. Applied egg-rr57.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr87.6%

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

    if -1.18e-4 < b < 3.49999999999999989e-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. Add Preprocessing
    3. Step-by-step derivation
      1. prod-diff83.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{{b}^{2} + \left(a \cdot \left(c \cdot -3\right) + \color{blue}{\left(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(3 \cdot a\right) \cdot c\right)}\right)}}{3 \cdot a} \]
    4. Applied egg-rr82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 79.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 57.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr87.6%

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

    if -0.00250000000000000005 < b < 2.39999999999999982e-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. Add Preprocessing
    3. Step-by-step derivation
      1. prod-diff83.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{{b}^{2} + \left(a \cdot \left(c \cdot -3\right) + \color{blue}{\left(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(3 \cdot a\right) \cdot c\right)}\right)}}{3 \cdot a} \]
    4. Applied egg-rr82.8%

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

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

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

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

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

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

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

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

Alternative 7: 72.2% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 62.5%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    9. Step-by-step derivation
      1. clear-num78.5%

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr78.8%

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

    if -1.5000000000000001e-147 < b < 1.45000000000000005e-146

    1. Initial program 82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \sqrt{\frac{c \cdot -3}{a}}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt42.6%

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

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

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

        \[\leadsto \sqrt{\left(\sqrt{\frac{c \cdot -3}{a}} \cdot 0.3333333333333333\right) \cdot \color{blue}{\left(\sqrt{\frac{c \cdot -3}{a}} \cdot 0.3333333333333333\right)}} \]
      5. swap-sqr42.7%

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

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

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

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

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

    if 1.45000000000000005e-146 < b

    1. Initial program 24.4%

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

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

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

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

Alternative 8: 68.0% accurate, 11.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 2.1 \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 2.1e-295) (/ b (* a -1.5)) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 2.1e-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 <= 2.1d-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 <= 2.1e-295) {
		tmp = b / (a * -1.5);
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 2.1e-295:
		tmp = b / (a * -1.5)
	else:
		tmp = (c / b) * -0.5
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 2.1e-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 <= 2.1e-295)
		tmp = b / (a * -1.5);
	else
		tmp = (c / b) * -0.5;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, 2.1e-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 2.1 \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 < 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. Add Preprocessing
    3. Applied egg-rr66.8%

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

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

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

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
    7. 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}} \]
    8. Simplified66.3%

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    9. 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}} \]
    10. Applied egg-rr66.5%

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

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

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

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

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

Alternative 9: 68.0% accurate, 11.6× speedup?

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
    5. 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. Add Preprocessing
    3. Taylor expanded in b around inf 65.1%

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

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

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

Alternative 10: 35.5% accurate, 23.2× speedup?

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

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

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

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

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

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

Alternative 11: 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. Add Preprocessing
  3. Applied egg-rr49.8%

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

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

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

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

    \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
  7. 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}} \]
  8. Simplified33.4%

    \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
  9. 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)))