Cubic critical

Percentage Accurate: 51.5% → 84.2%
Time: 20.3s
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.5% accurate, 1.0× speedup?

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

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

Alternative 1: 84.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}\\ \mathbf{if}\;b \leq -9.8 \cdot 10^{+126}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-131}:\\ \;\;\;\;\frac{t_0 - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 1.12 \cdot 10^{-76} \lor \neg \left(b \leq 2.05 \cdot 10^{-11}\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{3 \cdot \frac{a}{b + t_0}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (fma b b (* a (* c -3.0))))))
   (if (<= b -9.8e+126)
     (/ (* b -2.0) (* 3.0 a))
     (if (<= b 2e-131)
       (/ (- t_0 b) (* 3.0 a))
       (if (or (<= b 1.12e-76) (not (<= b 2.05e-11)))
         (/ (* c -0.5) b)
         (/ 1.0 (* 3.0 (/ a (+ b t_0)))))))))
double code(double a, double b, double c) {
	double t_0 = sqrt(fma(b, b, (a * (c * -3.0))));
	double tmp;
	if (b <= -9.8e+126) {
		tmp = (b * -2.0) / (3.0 * a);
	} else if (b <= 2e-131) {
		tmp = (t_0 - b) / (3.0 * a);
	} else if ((b <= 1.12e-76) || !(b <= 2.05e-11)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = 1.0 / (3.0 * (a / (b + t_0)));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = sqrt(fma(b, b, Float64(a * Float64(c * -3.0))))
	tmp = 0.0
	if (b <= -9.8e+126)
		tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a));
	elseif (b <= 2e-131)
		tmp = Float64(Float64(t_0 - b) / Float64(3.0 * a));
	elseif ((b <= 1.12e-76) || !(b <= 2.05e-11))
		tmp = Float64(Float64(c * -0.5) / b);
	else
		tmp = Float64(1.0 / Float64(3.0 * Float64(a / Float64(b + t_0))));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(b * b + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -9.8e+126], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2e-131], N[(N[(t$95$0 - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1.12e-76], N[Not[LessEqual[b, 2.05e-11]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(1.0 / N[(3.0 * N[(a / N[(b + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}\\
\mathbf{if}\;b \leq -9.8 \cdot 10^{+126}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\

\mathbf{elif}\;b \leq 2 \cdot 10^{-131}:\\
\;\;\;\;\frac{t_0 - b}{3 \cdot a}\\

\mathbf{elif}\;b \leq 1.12 \cdot 10^{-76} \lor \neg \left(b \leq 2.05 \cdot 10^{-11}\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{3 \cdot \frac{a}{b + t_0}}\\


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

    1. Initial program 52.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 98.1%

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

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

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

    if -9.80000000000000002e126 < b < 2e-131

    1. Initial program 89.7%

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

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

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

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

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

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

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

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

    if 2e-131 < b < 1.12e-76 or 2.05e-11 < b

    1. Initial program 12.8%

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

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

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

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

    if 1.12e-76 < b < 2.05e-11

    1. Initial program 67.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. prod-diff67.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. *-commutative67.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-neg67.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(b \cdot b - \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} \]
      4. prod-diff67.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(\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)\right)} + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}{3 \cdot a} \]
      5. *-commutative67.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left(\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)\right) + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}{3 \cdot a} \]
      6. fma-neg67.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{3 \cdot \frac{a}{b + \sqrt{0 + \mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification90.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -9.8 \cdot 10^{+126}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-131}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 1.12 \cdot 10^{-76} \lor \neg \left(b \leq 2.05 \cdot 10^{-11}\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{3 \cdot \frac{a}{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 84.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot \left(c \cdot -3\right)\\ \mathbf{if}\;b \leq -5 \cdot 10^{+126}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-132}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, t_0\right)} - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 1.9 \cdot 10^{-77} \lor \neg \left(b \leq 6 \cdot 10^{-12}\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{t_0}}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* a (* c -3.0))))
   (if (<= b -5e+126)
     (/ (* b -2.0) (* 3.0 a))
     (if (<= b 2.4e-132)
       (/ (- (sqrt (fma b b t_0)) b) (* 3.0 a))
       (if (or (<= b 1.9e-77) (not (<= b 6e-12)))
         (/ (* c -0.5) b)
         (* 0.3333333333333333 (/ (sqrt t_0) a)))))))
double code(double a, double b, double c) {
	double t_0 = a * (c * -3.0);
	double tmp;
	if (b <= -5e+126) {
		tmp = (b * -2.0) / (3.0 * a);
	} else if (b <= 2.4e-132) {
		tmp = (sqrt(fma(b, b, t_0)) - b) / (3.0 * a);
	} else if ((b <= 1.9e-77) || !(b <= 6e-12)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = 0.3333333333333333 * (sqrt(t_0) / a);
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(a * Float64(c * -3.0))
	tmp = 0.0
	if (b <= -5e+126)
		tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a));
	elseif (b <= 2.4e-132)
		tmp = Float64(Float64(sqrt(fma(b, b, t_0)) - b) / Float64(3.0 * a));
	elseif ((b <= 1.9e-77) || !(b <= 6e-12))
		tmp = Float64(Float64(c * -0.5) / b);
	else
		tmp = Float64(0.3333333333333333 * Float64(sqrt(t_0) / a));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -5e+126], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.4e-132], N[(N[(N[Sqrt[N[(b * b + t$95$0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 1.9e-77], N[Not[LessEqual[b, 6e-12]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(0.3333333333333333 * N[(N[Sqrt[t$95$0], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a \cdot \left(c \cdot -3\right)\\
\mathbf{if}\;b \leq -5 \cdot 10^{+126}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\

\mathbf{elif}\;b \leq 2.4 \cdot 10^{-132}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, t_0\right)} - b}{3 \cdot a}\\

\mathbf{elif}\;b \leq 1.9 \cdot 10^{-77} \lor \neg \left(b \leq 6 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\

\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{t_0}}{a}\\


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

    1. Initial program 52.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 98.1%

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

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

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

    if -4.99999999999999977e126 < b < 2.40000000000000015e-132

    1. Initial program 89.7%

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

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

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

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

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

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

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

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

    if 2.40000000000000015e-132 < b < 1.8999999999999999e-77 or 6.0000000000000003e-12 < b

    1. Initial program 12.8%

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

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

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

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

    if 1.8999999999999999e-77 < b < 6.0000000000000003e-12

    1. Initial program 67.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. prod-diff67.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. *-commutative67.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-neg67.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(b \cdot b - \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} \]
      4. prod-diff67.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(\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)\right)} + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}{3 \cdot a} \]
      5. *-commutative67.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left(\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)\right) + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}{3 \cdot a} \]
      6. fma-neg67.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification90.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+126}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-132}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 1.9 \cdot 10^{-77} \lor \neg \left(b \leq 6 \cdot 10^{-12}\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 78.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -3.8 \cdot 10^{-24}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-131} \lor \neg \left(b \leq 1.6 \cdot 10^{-77}\right) \land b \leq 4 \cdot 10^{-12}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -3.8e-24)
   (/ (* b -2.0) (* 3.0 a))
   (if (or (<= b 2e-131) (and (not (<= b 1.6e-77)) (<= b 4e-12)))
     (* 0.3333333333333333 (/ (sqrt (* a (* c -3.0))) a))
     (/ (* c -0.5) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -3.8e-24) {
		tmp = (b * -2.0) / (3.0 * a);
	} else if ((b <= 2e-131) || (!(b <= 1.6e-77) && (b <= 4e-12))) {
		tmp = 0.3333333333333333 * (sqrt((a * (c * -3.0))) / a);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-3.8d-24)) then
        tmp = (b * (-2.0d0)) / (3.0d0 * a)
    else if ((b <= 2d-131) .or. (.not. (b <= 1.6d-77)) .and. (b <= 4d-12)) then
        tmp = 0.3333333333333333d0 * (sqrt((a * (c * (-3.0d0)))) / a)
    else
        tmp = (c * (-0.5d0)) / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -3.8e-24) {
		tmp = (b * -2.0) / (3.0 * a);
	} else if ((b <= 2e-131) || (!(b <= 1.6e-77) && (b <= 4e-12))) {
		tmp = 0.3333333333333333 * (Math.sqrt((a * (c * -3.0))) / a);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -3.8e-24:
		tmp = (b * -2.0) / (3.0 * a)
	elif (b <= 2e-131) or (not (b <= 1.6e-77) and (b <= 4e-12)):
		tmp = 0.3333333333333333 * (math.sqrt((a * (c * -3.0))) / a)
	else:
		tmp = (c * -0.5) / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -3.8e-24)
		tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a));
	elseif ((b <= 2e-131) || (!(b <= 1.6e-77) && (b <= 4e-12)))
		tmp = Float64(0.3333333333333333 * Float64(sqrt(Float64(a * Float64(c * -3.0))) / a));
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -3.8e-24)
		tmp = (b * -2.0) / (3.0 * a);
	elseif ((b <= 2e-131) || (~((b <= 1.6e-77)) && (b <= 4e-12)))
		tmp = 0.3333333333333333 * (sqrt((a * (c * -3.0))) / a);
	else
		tmp = (c * -0.5) / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -3.8e-24], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 2e-131], And[N[Not[LessEqual[b, 1.6e-77]], $MachinePrecision], LessEqual[b, 4e-12]]], N[(0.3333333333333333 * N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 2 \cdot 10^{-131} \lor \neg \left(b \leq 1.6 \cdot 10^{-77}\right) \land b \leq 4 \cdot 10^{-12}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\

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


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

    1. Initial program 69.0%

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

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

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

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

    if -3.80000000000000026e-24 < b < 2e-131 or 1.6e-77 < b < 3.99999999999999992e-12

    1. Initial program 82.5%

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(\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)\right)} + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}{3 \cdot a} \]
      5. *-commutative82.3%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left(\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)\right) + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}{3 \cdot a} \]
      6. fma-neg82.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e-131 < b < 1.6e-77 or 3.99999999999999992e-12 < b

    1. Initial program 12.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.8 \cdot 10^{-24}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-131} \lor \neg \left(b \leq 1.6 \cdot 10^{-77}\right) \land b \leq 4 \cdot 10^{-12}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 79.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{a \cdot \left(c \cdot -3\right)}\\ \mathbf{if}\;b \leq -2.5 \cdot 10^{-23}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-131}:\\ \;\;\;\;\frac{t_0 - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{-77} \lor \neg \left(b \leq 4 \cdot 10^{-12}\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{t_0}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (* a (* c -3.0)))))
   (if (<= b -2.5e-23)
     (/ (* b -2.0) (* 3.0 a))
     (if (<= b 2e-131)
       (/ (- t_0 b) (* 3.0 a))
       (if (or (<= b 6.5e-77) (not (<= b 4e-12)))
         (/ (* c -0.5) b)
         (* 0.3333333333333333 (/ t_0 a)))))))
double code(double a, double b, double c) {
	double t_0 = sqrt((a * (c * -3.0)));
	double tmp;
	if (b <= -2.5e-23) {
		tmp = (b * -2.0) / (3.0 * a);
	} else if (b <= 2e-131) {
		tmp = (t_0 - b) / (3.0 * a);
	} else if ((b <= 6.5e-77) || !(b <= 4e-12)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = 0.3333333333333333 * (t_0 / a);
	}
	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) :: tmp
    t_0 = sqrt((a * (c * (-3.0d0))))
    if (b <= (-2.5d-23)) then
        tmp = (b * (-2.0d0)) / (3.0d0 * a)
    else if (b <= 2d-131) then
        tmp = (t_0 - b) / (3.0d0 * a)
    else if ((b <= 6.5d-77) .or. (.not. (b <= 4d-12))) then
        tmp = (c * (-0.5d0)) / b
    else
        tmp = 0.3333333333333333d0 * (t_0 / a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt((a * (c * -3.0)));
	double tmp;
	if (b <= -2.5e-23) {
		tmp = (b * -2.0) / (3.0 * a);
	} else if (b <= 2e-131) {
		tmp = (t_0 - b) / (3.0 * a);
	} else if ((b <= 6.5e-77) || !(b <= 4e-12)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = 0.3333333333333333 * (t_0 / a);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt((a * (c * -3.0)))
	tmp = 0
	if b <= -2.5e-23:
		tmp = (b * -2.0) / (3.0 * a)
	elif b <= 2e-131:
		tmp = (t_0 - b) / (3.0 * a)
	elif (b <= 6.5e-77) or not (b <= 4e-12):
		tmp = (c * -0.5) / b
	else:
		tmp = 0.3333333333333333 * (t_0 / a)
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(a * Float64(c * -3.0)))
	tmp = 0.0
	if (b <= -2.5e-23)
		tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a));
	elseif (b <= 2e-131)
		tmp = Float64(Float64(t_0 - b) / Float64(3.0 * a));
	elseif ((b <= 6.5e-77) || !(b <= 4e-12))
		tmp = Float64(Float64(c * -0.5) / b);
	else
		tmp = Float64(0.3333333333333333 * Float64(t_0 / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = sqrt((a * (c * -3.0)));
	tmp = 0.0;
	if (b <= -2.5e-23)
		tmp = (b * -2.0) / (3.0 * a);
	elseif (b <= 2e-131)
		tmp = (t_0 - b) / (3.0 * a);
	elseif ((b <= 6.5e-77) || ~((b <= 4e-12)))
		tmp = (c * -0.5) / b;
	else
		tmp = 0.3333333333333333 * (t_0 / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -2.5e-23], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2e-131], N[(N[(t$95$0 - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 6.5e-77], N[Not[LessEqual[b, 4e-12]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(0.3333333333333333 * N[(t$95$0 / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{a \cdot \left(c \cdot -3\right)}\\
\mathbf{if}\;b \leq -2.5 \cdot 10^{-23}:\\
\;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\

\mathbf{elif}\;b \leq 2 \cdot 10^{-131}:\\
\;\;\;\;\frac{t_0 - b}{3 \cdot a}\\

\mathbf{elif}\;b \leq 6.5 \cdot 10^{-77} \lor \neg \left(b \leq 4 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\

\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{t_0}{a}\\


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

    1. Initial program 69.0%

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

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

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

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

    if -2.5000000000000001e-23 < b < 2e-131

    1. Initial program 85.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-diff85.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. *-commutative85.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-neg85.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(b \cdot b - \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} \]
      4. prod-diff85.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(\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)\right)} + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}{3 \cdot a} \]
      5. *-commutative85.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left(\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)\right) + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}{3 \cdot a} \]
      6. fma-neg85.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e-131 < b < 6.4999999999999999e-77 or 3.99999999999999992e-12 < b

    1. Initial program 12.8%

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

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

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

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

    if 6.4999999999999999e-77 < b < 3.99999999999999992e-12

    1. Initial program 67.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. prod-diff67.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. *-commutative67.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-neg67.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(b \cdot b - \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} \]
      4. prod-diff67.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(\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)\right)} + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}{3 \cdot a} \]
      5. *-commutative67.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left(\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)\right) + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}{3 \cdot a} \]
      6. fma-neg67.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification85.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.5 \cdot 10^{-23}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-131}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{-77} \lor \neg \left(b \leq 4 \cdot 10^{-12}\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 84.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -6 \cdot 10^{+126}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-131}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 2.65 \cdot 10^{-77} \lor \neg \left(b \leq 5.1 \cdot 10^{-12}\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -6e+126)
   (/ (* b -2.0) (* 3.0 a))
   (if (<= b 2e-131)
     (/ (- (sqrt (- (* b b) (* (* 3.0 a) c))) b) (* 3.0 a))
     (if (or (<= b 2.65e-77) (not (<= b 5.1e-12)))
       (/ (* c -0.5) b)
       (* 0.3333333333333333 (/ (sqrt (* a (* c -3.0))) a))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -6e+126) {
		tmp = (b * -2.0) / (3.0 * a);
	} else if (b <= 2e-131) {
		tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
	} else if ((b <= 2.65e-77) || !(b <= 5.1e-12)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = 0.3333333333333333 * (sqrt((a * (c * -3.0))) / a);
	}
	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 <= (-6d+126)) then
        tmp = (b * (-2.0d0)) / (3.0d0 * a)
    else if (b <= 2d-131) then
        tmp = (sqrt(((b * b) - ((3.0d0 * a) * c))) - b) / (3.0d0 * a)
    else if ((b <= 2.65d-77) .or. (.not. (b <= 5.1d-12))) then
        tmp = (c * (-0.5d0)) / b
    else
        tmp = 0.3333333333333333d0 * (sqrt((a * (c * (-3.0d0)))) / a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -6e+126) {
		tmp = (b * -2.0) / (3.0 * a);
	} else if (b <= 2e-131) {
		tmp = (Math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
	} else if ((b <= 2.65e-77) || !(b <= 5.1e-12)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = 0.3333333333333333 * (Math.sqrt((a * (c * -3.0))) / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -6e+126:
		tmp = (b * -2.0) / (3.0 * a)
	elif b <= 2e-131:
		tmp = (math.sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a)
	elif (b <= 2.65e-77) or not (b <= 5.1e-12):
		tmp = (c * -0.5) / b
	else:
		tmp = 0.3333333333333333 * (math.sqrt((a * (c * -3.0))) / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -6e+126)
		tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a));
	elseif (b <= 2e-131)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c))) - b) / Float64(3.0 * a));
	elseif ((b <= 2.65e-77) || !(b <= 5.1e-12))
		tmp = Float64(Float64(c * -0.5) / b);
	else
		tmp = Float64(0.3333333333333333 * Float64(sqrt(Float64(a * Float64(c * -3.0))) / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -6e+126)
		tmp = (b * -2.0) / (3.0 * a);
	elseif (b <= 2e-131)
		tmp = (sqrt(((b * b) - ((3.0 * a) * c))) - b) / (3.0 * a);
	elseif ((b <= 2.65e-77) || ~((b <= 5.1e-12)))
		tmp = (c * -0.5) / b;
	else
		tmp = 0.3333333333333333 * (sqrt((a * (c * -3.0))) / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -6e+126], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2e-131], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 2.65e-77], N[Not[LessEqual[b, 5.1e-12]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(0.3333333333333333 * N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;b \leq 2.65 \cdot 10^{-77} \lor \neg \left(b \leq 5.1 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\

\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\


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

    1. Initial program 52.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 98.1%

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

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

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

    if -6.0000000000000005e126 < b < 2e-131

    1. Initial program 89.7%

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

    if 2e-131 < b < 2.65000000000000007e-77 or 5.09999999999999968e-12 < b

    1. Initial program 12.8%

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

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

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

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

    if 2.65000000000000007e-77 < b < 5.09999999999999968e-12

    1. Initial program 67.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. prod-diff67.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. *-commutative67.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-neg67.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(b \cdot b - \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} \]
      4. prod-diff67.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(\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)\right)} + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}{3 \cdot a} \]
      5. *-commutative67.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{\left(\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)\right) + \mathsf{fma}\left(-c, 3 \cdot a, c \cdot \left(3 \cdot a\right)\right)}}{3 \cdot a} \]
      6. fma-neg67.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification90.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6 \cdot 10^{+126}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-131}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\ \mathbf{elif}\;b \leq 2.65 \cdot 10^{-77} \lor \neg \left(b \leq 5.1 \cdot 10^{-12}\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 67.9% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 75.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-rr72.3%

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

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

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

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

      \[\leadsto \frac{0.3333333333333333}{a} \cdot \color{blue}{\left(-2 \cdot b\right)} \]
    7. Step-by-step derivation
      1. *-commutative69.9%

        \[\leadsto \frac{0.3333333333333333}{a} \cdot \color{blue}{\left(b \cdot -2\right)} \]
    8. Simplified69.9%

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

    if -4.999999999999985e-310 < b

    1. Initial program 27.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 72.2%

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

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

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

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

Alternative 7: 68.0% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 75.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 70.0%

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

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

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

    if 1.9999999999999988e-309 < b

    1. Initial program 27.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 72.2%

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

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

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

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

Alternative 8: 43.0% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 71.8%

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

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

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

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

    if 8.99999999999999953e-9 < b

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

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

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

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

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

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

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

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

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

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

Alternative 9: 67.6% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 75.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 69.8%

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 27.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 72.2%

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
      2. associate-/l*71.5%

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

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

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

Alternative 10: 67.9% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 75.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 69.8%

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 27.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 72.2%

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

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

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

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

Alternative 11: 10.9% accurate, 23.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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