Cubic critical

Percentage Accurate: 52.5% → 85.7%
Time: 38.5s
Alternatives: 12
Speedup: 11.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 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.5% accurate, 1.0× speedup?

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

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

Alternative 1: 85.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.3 \cdot 10^{+92}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{-59}:\\ \;\;\;\;\frac{\frac{b - \sqrt{\mathsf{fma}\left(-3, a \cdot c, {b}^{2}\right)}}{a}}{-3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.3e+92)
   (/ b (* a -1.5))
   (if (<= b 1.55e-59)
     (/ (/ (- b (sqrt (fma -3.0 (* a c) (pow b 2.0)))) a) -3.0)
     (* (/ c b) -0.5))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.3e+92) {
		tmp = b / (a * -1.5);
	} else if (b <= 1.55e-59) {
		tmp = ((b - sqrt(fma(-3.0, (a * c), pow(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.3e+92)
		tmp = Float64(b / Float64(a * -1.5));
	elseif (b <= 1.55e-59)
		tmp = Float64(Float64(Float64(b - sqrt(fma(-3.0, Float64(a * c), (b ^ 2.0)))) / a) / -3.0);
	else
		tmp = Float64(Float64(c / b) * -0.5);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -1.3e+92], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.55e-59], N[(N[(N[(b - N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision] + N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 1.55 \cdot 10^{-59}:\\
\;\;\;\;\frac{\frac{b - \sqrt{\mathsf{fma}\left(-3, a \cdot c, {b}^{2}\right)}}{a}}{-3}\\

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


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

    1. Initial program 53.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    12. Step-by-step derivation
      1. clear-num95.3%

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

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

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

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

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

    if -1.2999999999999999e92 < b < 1.55e-59

    1. Initial program 80.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.55e-59 < b

    1. Initial program 13.4%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.3 \cdot 10^{+92}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{-59}:\\ \;\;\;\;\frac{\frac{b - \sqrt{\mathsf{fma}\left(-3, a \cdot c, {b}^{2}\right)}}{a}}{-3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 85.7% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 53.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    12. Step-by-step derivation
      1. clear-num95.3%

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

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

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

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

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

    if -1.14999999999999999e92 < b < 9.49999999999999958e-60

    1. Initial program 80.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.49999999999999958e-60 < b

    1. Initial program 13.4%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.15 \cdot 10^{+92}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 9.5 \cdot 10^{-60}:\\ \;\;\;\;\frac{\frac{1}{\frac{a}{b - \sqrt{{b}^{2} + c \cdot \left(a \cdot -3\right)}}}}{-3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 85.9% accurate, 0.9× speedup?

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

\mathbf{elif}\;b \leq 2.15 \cdot 10^{-61}:\\
\;\;\;\;\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 < -3.0000000000000001e98

    1. Initial program 50.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. sqr-neg50.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    13. Applied egg-rr95.3%

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

    if -3.0000000000000001e98 < b < 2.1500000000000002e-61

    1. Initial program 80.9%

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

    if 2.1500000000000002e-61 < b

    1. Initial program 13.4%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{+98}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 2.15 \cdot 10^{-61}:\\ \;\;\;\;\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} \]
  5. Add Preprocessing

Alternative 4: 85.8% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 50.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. sqr-neg50.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    13. Applied egg-rr95.3%

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

    if -8.2000000000000001e98 < b < 1.40000000000000001e-62

    1. Initial program 80.9%

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

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

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

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

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

    if 1.40000000000000001e-62 < b

    1. Initial program 13.4%

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

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

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

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

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

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

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

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

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

Alternative 5: 80.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 65.4%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(-0.5 \cdot \frac{c}{{b}^{2}} + 0.6666666666666666 \cdot \frac{1}{a}\right)\right)} \]
    6. Taylor expanded in c around 0 91.3%

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

    if -1.3e-36 < b < 7.80000000000000038e-59

    1. Initial program 75.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.80000000000000038e-59 < b

    1. Initial program 13.4%

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

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

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

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

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

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

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

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

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

Alternative 6: 67.7% accurate, 7.2× speedup?

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

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

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


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

    1. Initial program 69.6%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(-0.5 \cdot \frac{c}{{b}^{2}} + 0.6666666666666666 \cdot \frac{1}{a}\right)\right)} \]
    6. Taylor expanded in c around 0 70.2%

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

    if -9.999999999999969e-311 < b

    1. Initial program 31.8%

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

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

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

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

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

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

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

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

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

Alternative 7: 67.6% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 69.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < b

    1. Initial program 31.8%

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

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

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

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

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

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

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

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

Alternative 8: 67.6% accurate, 11.6× speedup?

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

    1. Initial program 69.6%

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < b

    1. Initial program 31.8%

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

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

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

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

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

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

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

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

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

Alternative 9: 67.5% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 69.6%

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

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

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

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

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

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

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

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

    if 1.000000000000002e-309 < b

    1. Initial program 31.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 67.5% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 69.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.000000000000002e-309 < b

    1. Initial program 31.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 35.2% accurate, 23.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 2.5% accurate, 23.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{0.6666666666666666 \cdot \frac{b}{a}} \]
  8. Final simplification2.4%

    \[\leadsto \frac{b}{a} \cdot 0.6666666666666666 \]
  9. Add Preprocessing

Reproduce

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