Cubic critical

Percentage Accurate: 51.2% → 82.9%
Time: 11.9s
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: 51.2% 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: 82.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5.2 \cdot 10^{+25}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 9.2 \cdot 10^{-41}:\\ \;\;\;\;\left(b - \mathsf{hypot}\left(b, \sqrt{-3 \cdot \left(a \cdot c\right)}\right)\right) \cdot \frac{-0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -5.2e+25)
   (/ (* b -2.0) (* 3.0 a))
   (if (<= b 9.2e-41)
     (* (- b (hypot b (sqrt (* -3.0 (* a c))))) (/ -0.3333333333333333 a))
     (* (/ c b) -0.5))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5.2e+25) {
		tmp = (b * -2.0) / (3.0 * a);
	} else if (b <= 9.2e-41) {
		tmp = (b - hypot(b, sqrt((-3.0 * (a * c))))) * (-0.3333333333333333 / a);
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -5.2e+25) {
		tmp = (b * -2.0) / (3.0 * a);
	} else if (b <= 9.2e-41) {
		tmp = (b - Math.hypot(b, Math.sqrt((-3.0 * (a * c))))) * (-0.3333333333333333 / a);
	} else {
		tmp = (c / b) * -0.5;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -5.2e+25:
		tmp = (b * -2.0) / (3.0 * a)
	elif b <= 9.2e-41:
		tmp = (b - math.hypot(b, math.sqrt((-3.0 * (a * c))))) * (-0.3333333333333333 / a)
	else:
		tmp = (c / b) * -0.5
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -5.2e+25)
		tmp = Float64(Float64(b * -2.0) / Float64(3.0 * a));
	elseif (b <= 9.2e-41)
		tmp = Float64(Float64(b - hypot(b, sqrt(Float64(-3.0 * Float64(a * c))))) * Float64(-0.3333333333333333 / a));
	else
		tmp = Float64(Float64(c / b) * -0.5);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -5.2e+25)
		tmp = (b * -2.0) / (3.0 * a);
	elseif (b <= 9.2e-41)
		tmp = (b - hypot(b, sqrt((-3.0 * (a * c))))) * (-0.3333333333333333 / a);
	else
		tmp = (c / b) * -0.5;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -5.2e+25], N[(N[(b * -2.0), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.2e-41], N[(N[(b - N[Sqrt[b ^ 2 + N[Sqrt[N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 9.2 \cdot 10^{-41}:\\
\;\;\;\;\left(b - \mathsf{hypot}\left(b, \sqrt{-3 \cdot \left(a \cdot c\right)}\right)\right) \cdot \frac{-0.3333333333333333}{a}\\

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


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

    1. Initial program 56.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-neg56.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-neg56.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*56.2%

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

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

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

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

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

    if -5.1999999999999997e25 < b < 9.20000000000000041e-41

    1. Initial program 72.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-neg72.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-neg72.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*72.1%

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

        \[\leadsto \color{blue}{\left(-\left(\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}\right)\right) \cdot \frac{1}{-3 \cdot a}} \]
    6. Applied egg-rr72.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. Taylor expanded in a around 0 72.0%

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

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

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

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

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

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

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

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

    if 9.20000000000000041e-41 < b

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.2 \cdot 10^{+25}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 9.2 \cdot 10^{-41}:\\ \;\;\;\;\left(b - \mathsf{hypot}\left(b, \sqrt{-3 \cdot \left(a \cdot c\right)}\right)\right) \cdot \frac{-0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 85.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.8 \cdot 10^{+54}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\

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

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


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

    1. Initial program 51.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-neg51.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-neg51.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*51.2%

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

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

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

    if -1.8000000000000001e54 < b < 2.69999999999999999e-42

    1. Initial program 73.4%

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

    if 2.69999999999999999e-42 < b

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

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

Alternative 3: 85.1% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.8 \cdot 10^{+54}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\

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

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


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

    1. Initial program 51.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-neg51.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-neg51.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*51.2%

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

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

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

    if -1.8000000000000001e54 < b < 2.70000000000000016e-37

    1. Initial program 73.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-neg73.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-neg73.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*73.4%

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

    if 2.70000000000000016e-37 < b

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

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

Alternative 4: 80.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.7 \cdot 10^{-16}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\

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

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


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

    1. Initial program 60.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-neg60.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-neg60.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*60.5%

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

      \[\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 87.8%

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

    if -3.7e-16 < b < 4.5000000000000004e-37

    1. Initial program 70.3%

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

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

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

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

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

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

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

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

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

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

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

    if 4.5000000000000004e-37 < b

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.7 \cdot 10^{-16}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \mathbf{elif}\;b \leq 4.5 \cdot 10^{-37}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(-3 \cdot c\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 80.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 59.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-neg59.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-neg59.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*59.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified59.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
    5. Step-by-step derivation
      1. *-un-lft-identity59.8%

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

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

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

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

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

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

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

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

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

        \[\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. *-commutative31.6%

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

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

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

      \[\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 c around 0 0.8%

      \[\leadsto 0.3333333333333333 \cdot \color{blue}{\left(-1.5 \cdot \frac{c}{b} + 2 \cdot \frac{b}{a}\right)} \]
    8. Step-by-step derivation
      1. *-commutative0.8%

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

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

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

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

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

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

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

        \[\leadsto 0.3333333333333333 \cdot \left(-1.5 \cdot \frac{c}{b} + \left(-\frac{\color{blue}{b}}{a}\right) \cdot 2\right) \]
      9. cancel-sign-sub-inv85.1%

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

        \[\leadsto 0.3333333333333333 \cdot \left(-1.5 \cdot \frac{c}{b} - \color{blue}{2 \cdot \frac{b}{a}}\right) \]
      11. add-sqr-sqrt47.7%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{\sqrt{-1.5 \cdot \frac{c}{b}} \cdot \sqrt{-1.5 \cdot \frac{c}{b}}} - 2 \cdot \frac{b}{a}\right) \]
      12. sqrt-unprod83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{\sqrt{\left(-1.5 \cdot \frac{c}{b}\right) \cdot \left(-1.5 \cdot \frac{c}{b}\right)}} - 2 \cdot \frac{b}{a}\right) \]
      13. swap-sqr83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{\left(-1.5 \cdot -1.5\right) \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)}} - 2 \cdot \frac{b}{a}\right) \]
      14. metadata-eval83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{2.25} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)} - 2 \cdot \frac{b}{a}\right) \]
      15. metadata-eval83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{\left(1.5 \cdot 1.5\right)} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)} - 2 \cdot \frac{b}{a}\right) \]
      16. swap-sqr83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{\left(1.5 \cdot \frac{c}{b}\right) \cdot \left(1.5 \cdot \frac{c}{b}\right)}} - 2 \cdot \frac{b}{a}\right) \]
      17. sqrt-unprod62.2%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{\sqrt{1.5 \cdot \frac{c}{b}} \cdot \sqrt{1.5 \cdot \frac{c}{b}}} - 2 \cdot \frac{b}{a}\right) \]
      18. add-sqr-sqrt86.5%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{1.5 \cdot \frac{c}{b}} - 2 \cdot \frac{b}{a}\right) \]
    9. Applied egg-rr86.5%

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

    if -9.50000000000000037e-27 < b < 4.60000000000000003e-38

    1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

    if 4.60000000000000003e-38 < b

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

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

Alternative 6: 80.5% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 59.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-neg59.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-neg59.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*59.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified59.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
    5. Step-by-step derivation
      1. *-un-lft-identity59.8%

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

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

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

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

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

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

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

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

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

        \[\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. *-commutative31.6%

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

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

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

      \[\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 c around 0 0.8%

      \[\leadsto 0.3333333333333333 \cdot \color{blue}{\left(-1.5 \cdot \frac{c}{b} + 2 \cdot \frac{b}{a}\right)} \]
    8. Step-by-step derivation
      1. *-commutative0.8%

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

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

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

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

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

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

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

        \[\leadsto 0.3333333333333333 \cdot \left(-1.5 \cdot \frac{c}{b} + \left(-\frac{\color{blue}{b}}{a}\right) \cdot 2\right) \]
      9. cancel-sign-sub-inv85.1%

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

        \[\leadsto 0.3333333333333333 \cdot \left(-1.5 \cdot \frac{c}{b} - \color{blue}{2 \cdot \frac{b}{a}}\right) \]
      11. add-sqr-sqrt47.7%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{\sqrt{-1.5 \cdot \frac{c}{b}} \cdot \sqrt{-1.5 \cdot \frac{c}{b}}} - 2 \cdot \frac{b}{a}\right) \]
      12. sqrt-unprod83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{\sqrt{\left(-1.5 \cdot \frac{c}{b}\right) \cdot \left(-1.5 \cdot \frac{c}{b}\right)}} - 2 \cdot \frac{b}{a}\right) \]
      13. swap-sqr83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{\left(-1.5 \cdot -1.5\right) \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)}} - 2 \cdot \frac{b}{a}\right) \]
      14. metadata-eval83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{2.25} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)} - 2 \cdot \frac{b}{a}\right) \]
      15. metadata-eval83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{\left(1.5 \cdot 1.5\right)} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)} - 2 \cdot \frac{b}{a}\right) \]
      16. swap-sqr83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{\left(1.5 \cdot \frac{c}{b}\right) \cdot \left(1.5 \cdot \frac{c}{b}\right)}} - 2 \cdot \frac{b}{a}\right) \]
      17. sqrt-unprod62.2%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{\sqrt{1.5 \cdot \frac{c}{b}} \cdot \sqrt{1.5 \cdot \frac{c}{b}}} - 2 \cdot \frac{b}{a}\right) \]
      18. add-sqr-sqrt86.5%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{1.5 \cdot \frac{c}{b}} - 2 \cdot \frac{b}{a}\right) \]
    9. Applied egg-rr86.5%

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

    if -9.99999999999999971e-29 < b < 2.45e-42

    1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

    if 2.45e-42 < b

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

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

Alternative 7: 80.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 59.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-neg59.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-neg59.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*59.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified59.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
    5. Step-by-step derivation
      1. *-un-lft-identity59.8%

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

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

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

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

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

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

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

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

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

        \[\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. *-commutative31.6%

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

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

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

      \[\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 c around 0 0.8%

      \[\leadsto 0.3333333333333333 \cdot \color{blue}{\left(-1.5 \cdot \frac{c}{b} + 2 \cdot \frac{b}{a}\right)} \]
    8. Step-by-step derivation
      1. *-commutative0.8%

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

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

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

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

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

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

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

        \[\leadsto 0.3333333333333333 \cdot \left(-1.5 \cdot \frac{c}{b} + \left(-\frac{\color{blue}{b}}{a}\right) \cdot 2\right) \]
      9. cancel-sign-sub-inv85.1%

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

        \[\leadsto 0.3333333333333333 \cdot \left(-1.5 \cdot \frac{c}{b} - \color{blue}{2 \cdot \frac{b}{a}}\right) \]
      11. add-sqr-sqrt47.7%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{\sqrt{-1.5 \cdot \frac{c}{b}} \cdot \sqrt{-1.5 \cdot \frac{c}{b}}} - 2 \cdot \frac{b}{a}\right) \]
      12. sqrt-unprod83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{\sqrt{\left(-1.5 \cdot \frac{c}{b}\right) \cdot \left(-1.5 \cdot \frac{c}{b}\right)}} - 2 \cdot \frac{b}{a}\right) \]
      13. swap-sqr83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{\left(-1.5 \cdot -1.5\right) \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)}} - 2 \cdot \frac{b}{a}\right) \]
      14. metadata-eval83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{2.25} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)} - 2 \cdot \frac{b}{a}\right) \]
      15. metadata-eval83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{\left(1.5 \cdot 1.5\right)} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)} - 2 \cdot \frac{b}{a}\right) \]
      16. swap-sqr83.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{\left(1.5 \cdot \frac{c}{b}\right) \cdot \left(1.5 \cdot \frac{c}{b}\right)}} - 2 \cdot \frac{b}{a}\right) \]
      17. sqrt-unprod62.2%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{\sqrt{1.5 \cdot \frac{c}{b}} \cdot \sqrt{1.5 \cdot \frac{c}{b}}} - 2 \cdot \frac{b}{a}\right) \]
      18. add-sqr-sqrt86.5%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{1.5 \cdot \frac{c}{b}} - 2 \cdot \frac{b}{a}\right) \]
    9. Applied egg-rr86.5%

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

    if -1.3500000000000001e-22 < b < 1.90000000000000009e-42

    1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.90000000000000009e-42 < b

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.35 \cdot 10^{-22}:\\ \;\;\;\;0.3333333333333333 \cdot \left(\frac{c}{b} \cdot 1.5 - 2 \cdot \frac{b}{a}\right)\\ \mathbf{elif}\;b \leq 1.9 \cdot 10^{-42}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{-3 \cdot \left(a \cdot c\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 68.5% accurate, 6.4× speedup?

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

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

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


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

    1. Initial program 68.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-neg68.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-neg68.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*68.0%

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

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

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

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

        \[\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-sqrt67.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} \]
      5. sqrt-unprod67.4%

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

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

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

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

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

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

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

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

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

      \[\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 c around 0 0.9%

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

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

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

        \[\leadsto 0.3333333333333333 \cdot \left(-1.5 \cdot \frac{c}{b} + \color{blue}{\left(-\frac{-b}{a}\right)} \cdot 2\right) \]
      4. add-sqr-sqrt0.9%

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

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

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

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

        \[\leadsto 0.3333333333333333 \cdot \left(-1.5 \cdot \frac{c}{b} + \left(-\frac{\color{blue}{b}}{a}\right) \cdot 2\right) \]
      9. cancel-sign-sub-inv60.9%

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

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

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{\sqrt{-1.5 \cdot \frac{c}{b}} \cdot \sqrt{-1.5 \cdot \frac{c}{b}}} - 2 \cdot \frac{b}{a}\right) \]
      12. sqrt-unprod60.5%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{\sqrt{\left(-1.5 \cdot \frac{c}{b}\right) \cdot \left(-1.5 \cdot \frac{c}{b}\right)}} - 2 \cdot \frac{b}{a}\right) \]
      13. swap-sqr60.5%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{\left(-1.5 \cdot -1.5\right) \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)}} - 2 \cdot \frac{b}{a}\right) \]
      14. metadata-eval60.5%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{2.25} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)} - 2 \cdot \frac{b}{a}\right) \]
      15. metadata-eval60.5%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{\left(1.5 \cdot 1.5\right)} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)} - 2 \cdot \frac{b}{a}\right) \]
      16. swap-sqr60.5%

        \[\leadsto 0.3333333333333333 \cdot \left(\sqrt{\color{blue}{\left(1.5 \cdot \frac{c}{b}\right) \cdot \left(1.5 \cdot \frac{c}{b}\right)}} - 2 \cdot \frac{b}{a}\right) \]
      17. sqrt-unprod43.4%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{\sqrt{1.5 \cdot \frac{c}{b}} \cdot \sqrt{1.5 \cdot \frac{c}{b}}} - 2 \cdot \frac{b}{a}\right) \]
      18. add-sqr-sqrt63.1%

        \[\leadsto 0.3333333333333333 \cdot \left(\color{blue}{1.5 \cdot \frac{c}{b}} - 2 \cdot \frac{b}{a}\right) \]
    9. Applied egg-rr63.1%

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

    if -5.00000000000023e-311 < b

    1. Initial program 31.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-neg31.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-neg31.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*31.5%

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

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

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

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

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

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

Alternative 9: 68.4% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 68.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-neg68.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-neg68.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*68.0%

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

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

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

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

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

    if 2.2e-307 < b

    1. Initial program 31.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-neg31.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-neg31.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*31.5%

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

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

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

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

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

Alternative 10: 68.4% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 68.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-neg68.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-neg68.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*68.0%

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

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

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

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

      \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
    8. Step-by-step derivation
      1. associate-*l/62.7%

        \[\leadsto \color{blue}{\frac{b \cdot -0.6666666666666666}{a}} \]
      2. clear-num62.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{b \cdot -0.6666666666666666}}} \]
    9. Applied egg-rr62.7%

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

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

        \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    11. Applied egg-rr62.8%

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

    if -5.00000000000023e-311 < b

    1. Initial program 31.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-neg31.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-neg31.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*31.5%

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

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

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

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

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

Alternative 11: 44.1% accurate, 11.6× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 67.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-neg67.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-neg67.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*67.8%

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

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

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

      \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
    8. Step-by-step derivation
      1. associate-*l/63.2%

        \[\leadsto \color{blue}{\frac{b \cdot -0.6666666666666666}{a}} \]
      2. clear-num63.1%

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{b \cdot -0.6666666666666666}}} \]
    9. Applied egg-rr63.1%

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

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

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

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

    if -6.6000000000000004e-299 < b

    1. Initial program 32.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 11.8% accurate, 116.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (a b c) :precision binary64 0.0)
double code(double a, double b, double c) {
	return 0.0;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = 0.0d0
end function
public static double code(double a, double b, double c) {
	return 0.0;
}
def code(a, b, c):
	return 0.0
function code(a, b, c)
	return 0.0
end
function tmp = code(a, b, c)
	tmp = 0.0;
end
code[a_, b_, c_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 50.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-neg50.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-neg50.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*50.6%

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

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

    \[\leadsto \color{blue}{0} \]
  7. Add Preprocessing

Reproduce

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