Cubic critical

Percentage Accurate: 52.7% → 85.1%
Time: 14.8s
Alternatives: 13
Speedup: 16.4×

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 13 alternatives:

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

Initial Program: 52.7% accurate, 1.0× speedup?

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

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

Alternative 1: 85.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.3 \cdot 10^{+152}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{elif}\;b \leq 9.2 \cdot 10^{-48}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2.3e+152)
   (fma 0.5 (/ c b) (/ b (/ a -0.6666666666666666)))
   (if (<= b 9.2e-48)
     (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))
     (* (/ c b) -0.5))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.3e+152) {
		tmp = fma(0.5, (c / b), (b / (a / -0.6666666666666666)));
	} else if (b <= 9.2e-48) {
		tmp = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -2.3e+152)
		tmp = fma(0.5, Float64(c / b), Float64(b / Float64(a / -0.6666666666666666)));
	elseif (b <= 9.2e-48)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0));
	else
		tmp = Float64(Float64(c / b) * -0.5);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -2.3e+152], N[(0.5 * N[(c / b), $MachinePrecision] + N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.2e-48], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{+152}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\

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

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


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

    1. Initial program 40.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-0.16666666666666666 \cdot \color{blue}{-3}\right) \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      8. metadata-eval98.3%

        \[\leadsto \frac{\color{blue}{0.5} \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      9. associate-*r/98.3%

        \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b}} + \frac{b}{a} \cdot -0.6666666666666666 \]
      10. fma-def98.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{a} \cdot -0.6666666666666666\right)} \]
      11. associate-/r/99.7%

        \[\leadsto \mathsf{fma}\left(0.5, \frac{c}{b}, \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}}\right) \]
    8. Simplified99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)} \]

    if -2.29999999999999985e152 < b < 9.2000000000000003e-48

    1. Initial program 81.1%

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

    if 9.2000000000000003e-48 < b

    1. Initial program 15.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.3 \cdot 10^{+152}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{elif}\;b \leq 9.2 \cdot 10^{-48}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

Alternative 2: 84.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -4.5 \cdot 10^{+35}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{elif}\;b \leq 9 \cdot 10^{-48}:\\ \;\;\;\;\left(\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - 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 -4.5e+35)
   (fma 0.5 (/ c b) (/ b (/ a -0.6666666666666666)))
   (if (<= b 9e-48)
     (* (- (sqrt (+ (* b b) (* a (* c -3.0)))) b) (/ 0.3333333333333333 a))
     (* (/ c b) -0.5))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -4.5e+35) {
		tmp = fma(0.5, (c / b), (b / (a / -0.6666666666666666)));
	} else if (b <= 9e-48) {
		tmp = (sqrt(((b * b) + (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 <= -4.5e+35)
		tmp = fma(0.5, Float64(c / b), Float64(b / Float64(a / -0.6666666666666666)));
	elseif (b <= 9e-48)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -3.0)))) - b) * Float64(0.3333333333333333 / a));
	else
		tmp = Float64(Float64(c / b) * -0.5);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -4.5e+35], N[(0.5 * N[(c / b), $MachinePrecision] + N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9e-48], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $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 -4.5 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\

\mathbf{elif}\;b \leq 9 \cdot 10^{-48}:\\
\;\;\;\;\left(\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - 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 < -4.4999999999999997e35

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-0.16666666666666666 \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}\right) \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      7. rem-square-sqrt97.4%

        \[\leadsto \frac{\left(-0.16666666666666666 \cdot \color{blue}{-3}\right) \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      8. metadata-eval97.4%

        \[\leadsto \frac{\color{blue}{0.5} \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      9. associate-*r/97.4%

        \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b}} + \frac{b}{a} \cdot -0.6666666666666666 \]
      10. fma-def97.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{a} \cdot -0.6666666666666666\right)} \]
      11. associate-/r/98.5%

        \[\leadsto \mathsf{fma}\left(0.5, \frac{c}{b}, \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}}\right) \]
    8. Simplified98.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)} \]

    if -4.4999999999999997e35 < b < 8.99999999999999977e-48

    1. Initial program 77.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.99999999999999977e-48 < b

    1. Initial program 15.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.5 \cdot 10^{+35}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{elif}\;b \leq 9 \cdot 10^{-48}:\\ \;\;\;\;\left(\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

Alternative 3: 85.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.1 \cdot 10^{+152}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{elif}\;b \leq 1.08 \cdot 10^{-47}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.1e+152)
   (fma 0.5 (/ c b) (/ b (/ a -0.6666666666666666)))
   (if (<= b 1.08e-47)
     (/ (- (sqrt (- (* b b) (* 3.0 (* c a)))) b) (* a 3.0))
     (* (/ c b) -0.5))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.1e+152) {
		tmp = fma(0.5, (c / b), (b / (a / -0.6666666666666666)));
	} else if (b <= 1.08e-47) {
		tmp = (sqrt(((b * b) - (3.0 * (c * a)))) - b) / (a * 3.0);
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.1e+152)
		tmp = fma(0.5, Float64(c / b), Float64(b / Float64(a / -0.6666666666666666)));
	elseif (b <= 1.08e-47)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(c * a)))) - b) / Float64(a * 3.0));
	else
		tmp = Float64(Float64(c / b) * -0.5);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -1.1e+152], N[(0.5 * N[(c / b), $MachinePrecision] + N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.08e-47], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.1 \cdot 10^{+152}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\

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

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


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

    1. Initial program 40.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-0.16666666666666666 \cdot \color{blue}{-3}\right) \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      8. metadata-eval98.3%

        \[\leadsto \frac{\color{blue}{0.5} \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      9. associate-*r/98.3%

        \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b}} + \frac{b}{a} \cdot -0.6666666666666666 \]
      10. fma-def98.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{a} \cdot -0.6666666666666666\right)} \]
      11. associate-/r/99.7%

        \[\leadsto \mathsf{fma}\left(0.5, \frac{c}{b}, \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}}\right) \]
    8. Simplified99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)} \]

    if -1.0999999999999999e152 < b < 1.08000000000000005e-47

    1. Initial program 81.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.08000000000000005e-47 < b

    1. Initial program 15.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.1 \cdot 10^{+152}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{elif}\;b \leq 1.08 \cdot 10^{-47}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

Alternative 4: 78.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5.5 \cdot 10^{-137}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{elif}\;b \leq 1.25 \cdot 10^{-47}:\\ \;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(\sqrt{\left(c \cdot a\right) \cdot -3} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -5.5e-137)
   (fma 0.5 (/ c b) (/ b (/ a -0.6666666666666666)))
   (if (<= b 1.25e-47)
     (* (/ 0.3333333333333333 a) (- (sqrt (* (* c a) -3.0)) b))
     (* (/ c b) -0.5))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5.5e-137) {
		tmp = fma(0.5, (c / b), (b / (a / -0.6666666666666666)));
	} else if (b <= 1.25e-47) {
		tmp = (0.3333333333333333 / a) * (sqrt(((c * a) * -3.0)) - b);
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -5.5e-137)
		tmp = fma(0.5, Float64(c / b), Float64(b / Float64(a / -0.6666666666666666)));
	elseif (b <= 1.25e-47)
		tmp = Float64(Float64(0.3333333333333333 / a) * Float64(sqrt(Float64(Float64(c * a) * -3.0)) - b));
	else
		tmp = Float64(Float64(c / b) * -0.5);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -5.5e-137], N[(0.5 * N[(c / b), $MachinePrecision] + N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.25e-47], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(N[Sqrt[N[(N[(c * a), $MachinePrecision] * -3.0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.5 \cdot 10^{-137}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\

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

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


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

    1. Initial program 65.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-0.16666666666666666 \cdot \color{blue}{-3}\right) \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      8. metadata-eval88.5%

        \[\leadsto \frac{\color{blue}{0.5} \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      9. associate-*r/88.5%

        \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b}} + \frac{b}{a} \cdot -0.6666666666666666 \]
      10. fma-def88.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{a} \cdot -0.6666666666666666\right)} \]
      11. associate-/r/89.3%

        \[\leadsto \mathsf{fma}\left(0.5, \frac{c}{b}, \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}}\right) \]
    8. Simplified89.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)} \]

    if -5.5000000000000003e-137 < b < 1.25000000000000003e-47

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.25000000000000003e-47 < b

    1. Initial program 15.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.5 \cdot 10^{-137}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{elif}\;b \leq 1.25 \cdot 10^{-47}:\\ \;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(\sqrt{\left(c \cdot a\right) \cdot -3} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

Alternative 5: 78.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.9 \cdot 10^{-137}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{elif}\;b \leq 1.7 \cdot 10^{-47}:\\ \;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(\sqrt{a \cdot \left(c \cdot -3\right)} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.9e-137)
   (fma 0.5 (/ c b) (/ b (/ a -0.6666666666666666)))
   (if (<= b 1.7e-47)
     (* (/ 0.3333333333333333 a) (- (sqrt (* a (* c -3.0))) b))
     (* (/ c b) -0.5))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.9e-137) {
		tmp = fma(0.5, (c / b), (b / (a / -0.6666666666666666)));
	} else if (b <= 1.7e-47) {
		tmp = (0.3333333333333333 / a) * (sqrt((a * (c * -3.0))) - b);
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.9e-137)
		tmp = fma(0.5, Float64(c / b), Float64(b / Float64(a / -0.6666666666666666)));
	elseif (b <= 1.7e-47)
		tmp = Float64(Float64(0.3333333333333333 / a) * Float64(sqrt(Float64(a * Float64(c * -3.0))) - b));
	else
		tmp = Float64(Float64(c / b) * -0.5);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -1.9e-137], N[(0.5 * N[(c / b), $MachinePrecision] + N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.7e-47], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.9 \cdot 10^{-137}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\

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

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


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

    1. Initial program 65.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-0.16666666666666666 \cdot \color{blue}{-3}\right) \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      8. metadata-eval88.5%

        \[\leadsto \frac{\color{blue}{0.5} \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      9. associate-*r/88.5%

        \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b}} + \frac{b}{a} \cdot -0.6666666666666666 \]
      10. fma-def88.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{a} \cdot -0.6666666666666666\right)} \]
      11. associate-/r/89.3%

        \[\leadsto \mathsf{fma}\left(0.5, \frac{c}{b}, \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}}\right) \]
    8. Simplified89.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)} \]

    if -1.89999999999999999e-137 < b < 1.7000000000000001e-47

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.7000000000000001e-47 < b

    1. Initial program 15.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.9 \cdot 10^{-137}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{elif}\;b \leq 1.7 \cdot 10^{-47}:\\ \;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(\sqrt{a \cdot \left(c \cdot -3\right)} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

Alternative 6: 78.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5.5 \cdot 10^{-137}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{elif}\;b \leq 1.08 \cdot 10^{-47}:\\ \;\;\;\;\frac{0.3333333333333333 \cdot \left(\sqrt{a \cdot \left(c \cdot -3\right)} - b\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -5.5e-137)
   (fma 0.5 (/ c b) (/ b (/ a -0.6666666666666666)))
   (if (<= b 1.08e-47)
     (/ (* 0.3333333333333333 (- (sqrt (* a (* c -3.0))) b)) a)
     (* (/ c b) -0.5))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5.5e-137) {
		tmp = fma(0.5, (c / b), (b / (a / -0.6666666666666666)));
	} else if (b <= 1.08e-47) {
		tmp = (0.3333333333333333 * (sqrt((a * (c * -3.0))) - b)) / a;
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -5.5e-137)
		tmp = fma(0.5, Float64(c / b), Float64(b / Float64(a / -0.6666666666666666)));
	elseif (b <= 1.08e-47)
		tmp = Float64(Float64(0.3333333333333333 * Float64(sqrt(Float64(a * Float64(c * -3.0))) - b)) / a);
	else
		tmp = Float64(Float64(c / b) * -0.5);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -5.5e-137], N[(0.5 * N[(c / b), $MachinePrecision] + N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.08e-47], N[(N[(0.3333333333333333 * N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.5 \cdot 10^{-137}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\

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

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


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

    1. Initial program 65.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-0.16666666666666666 \cdot \color{blue}{-3}\right) \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      8. metadata-eval88.5%

        \[\leadsto \frac{\color{blue}{0.5} \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      9. associate-*r/88.5%

        \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b}} + \frac{b}{a} \cdot -0.6666666666666666 \]
      10. fma-def88.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{a} \cdot -0.6666666666666666\right)} \]
      11. associate-/r/89.3%

        \[\leadsto \mathsf{fma}\left(0.5, \frac{c}{b}, \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}}\right) \]
    8. Simplified89.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)} \]

    if -5.5000000000000003e-137 < b < 1.08000000000000005e-47

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.08000000000000005e-47 < b

    1. Initial program 15.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.5 \cdot 10^{-137}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{elif}\;b \leq 1.08 \cdot 10^{-47}:\\ \;\;\;\;\frac{0.3333333333333333 \cdot \left(\sqrt{a \cdot \left(c \cdot -3\right)} - b\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

Alternative 7: 66.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -5e-310)
   (fma 0.5 (/ c b) (/ b (/ a -0.6666666666666666)))
   (* (/ c b) -0.5)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5e-310) {
		tmp = fma(0.5, (c / b), (b / (a / -0.6666666666666666)));
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -5e-310)
		tmp = fma(0.5, Float64(c / b), Float64(b / Float64(a / -0.6666666666666666)));
	else
		tmp = Float64(Float64(c / b) * -0.5);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -5e-310], N[(0.5 * N[(c / b), $MachinePrecision] + N[(b / N[(a / -0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\

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


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

    1. Initial program 65.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. /-rgt-identity65.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-0.16666666666666666 \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}\right) \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      7. rem-square-sqrt79.4%

        \[\leadsto \frac{\left(-0.16666666666666666 \cdot \color{blue}{-3}\right) \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      8. metadata-eval79.4%

        \[\leadsto \frac{\color{blue}{0.5} \cdot c}{b} + \frac{b}{a} \cdot -0.6666666666666666 \]
      9. associate-*r/79.4%

        \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b}} + \frac{b}{a} \cdot -0.6666666666666666 \]
      10. fma-def79.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{a} \cdot -0.6666666666666666\right)} \]
      11. associate-/r/80.1%

        \[\leadsto \mathsf{fma}\left(0.5, \frac{c}{b}, \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}}\right) \]
    8. Simplified80.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)} \]

    if -4.999999999999985e-310 < b

    1. Initial program 30.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\mathsf{fma}\left(0.5, \frac{c}{b}, \frac{b}{\frac{a}{-0.6666666666666666}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

Alternative 8: 66.8% accurate, 6.8× speedup?

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

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

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


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

    1. Initial program 65.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. /-rgt-identity65.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-0.3333333333333333 \cdot \color{blue}{\left(-1.5 \cdot \frac{c \cdot a}{b} + 2 \cdot b\right)}}{a} \]
    5. Step-by-step derivation
      1. expm1-log1p-u71.9%

        \[\leadsto \frac{-0.3333333333333333 \cdot \left(-1.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c \cdot a}{b}\right)\right)} + 2 \cdot b\right)}{a} \]
      2. expm1-udef71.6%

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

        \[\leadsto \frac{-0.3333333333333333 \cdot \left(-1.5 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{c}{\frac{b}{a}}}\right)} - 1\right) + 2 \cdot b\right)}{a} \]
    6. Applied egg-rr74.7%

      \[\leadsto \frac{-0.3333333333333333 \cdot \left(-1.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{c}{\frac{b}{a}}\right)} - 1\right)} + 2 \cdot b\right)}{a} \]
    7. Step-by-step derivation
      1. expm1-def75.0%

        \[\leadsto \frac{-0.3333333333333333 \cdot \left(-1.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{\frac{b}{a}}\right)\right)} + 2 \cdot b\right)}{a} \]
      2. expm1-log1p79.8%

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 30.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 66.8% accurate, 8.9× speedup?

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

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

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


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

    1. Initial program 65.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. neg-sub065.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 30.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 66.7% accurate, 12.8× speedup?

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

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


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

    1. Initial program 66.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}}{3 \cdot a} \]
      3. cancel-sign-sub-inv66.0%

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

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

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

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

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

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

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

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

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

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

    if 1.45000000000000007e-303 < b

    1. Initial program 29.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. neg-sub029.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.45 \cdot 10^{-303}:\\ \;\;\;\;\frac{b \cdot -2}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

Alternative 11: 66.7% accurate, 16.4× speedup?

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

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

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


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

    1. Initial program 66.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.45000000000000007e-303 < b

    1. Initial program 29.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. neg-sub029.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.45 \cdot 10^{-303}:\\ \;\;\;\;-0.6666666666666666 \cdot \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]

Alternative 12: 66.7% accurate, 16.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.3 \cdot 10^{-302}:\\
\;\;\;\;\frac{b}{\frac{a}{-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.30000000000000002e-302

    1. Initial program 66.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      2. associate-/r/78.6%

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

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

    if 2.30000000000000002e-302 < b

    1. Initial program 29.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. neg-sub029.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 34.6% accurate, 23.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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