Cubic critical

Percentage Accurate: 51.5% → 85.3%
Time: 14.0s
Alternatives: 13
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 13 alternatives:

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

Initial Program: 51.5% accurate, 1.0× speedup?

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

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

Alternative 1: 85.3% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 47.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-neg47.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-neg47.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*47.1%

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

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

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

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

    if -3.25000000000000009e121 < b < 6.49999999999999984e-80

    1. Initial program 80.3%

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

    if 6.49999999999999984e-80 < b

    1. Initial program 14.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-neg14.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-neg14.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*14.5%

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

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

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

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

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

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

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

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

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

Alternative 2: 85.2% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 47.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-neg47.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-neg47.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*47.1%

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

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

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

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

    if -3.60000000000000016e120 < b < 9.20000000000000047e-79

    1. Initial program 80.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-neg80.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-neg80.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*80.0%

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

    if 9.20000000000000047e-79 < b

    1. Initial program 14.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-neg14.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-neg14.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*14.5%

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

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

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

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

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

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

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

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

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

Alternative 3: 80.2% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 69.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-neg69.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-neg69.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*69.8%

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

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

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

    if -7.1999999999999996e-104 < b < 2.2999999999999998e-80

    1. Initial program 71.1%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Step-by-step derivation
      1. sqr-neg71.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-neg71.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*70.5%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified70.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 0 69.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. *-commutative69.9%

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

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

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

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

    if 2.2999999999999998e-80 < b

    1. Initial program 14.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-neg14.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-neg14.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*14.5%

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

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

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

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

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

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

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

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

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

Alternative 4: 79.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 69.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-neg69.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-neg69.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*69.8%

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

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

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

    if -1.99999999999999992e-103 < b < 1.55000000000000009e-78

    1. Initial program 71.1%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Step-by-step derivation
      1. sqr-neg71.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-neg71.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*70.5%

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

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

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

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

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

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

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

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

        \[\leadsto 0.3333333333333333 \cdot \frac{\color{blue}{b} + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{a} \]
      9. fma-neg70.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. associate-*r*70.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.55000000000000009e-78 < b

    1. Initial program 14.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-neg14.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-neg14.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*14.5%

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

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

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

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

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

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

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

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

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

Alternative 5: 79.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 69.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-neg69.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-neg69.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*69.8%

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

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

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

    if -2.7999999999999999e-107 < b < 3.09999999999999988e-81

    1. Initial program 71.1%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Step-by-step derivation
      1. sqr-neg71.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-neg71.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*70.5%

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

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

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

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

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

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

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

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

        \[\leadsto 0.3333333333333333 \cdot \frac{\color{blue}{b} + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{a} \]
      9. fma-neg70.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. associate-*r*70.3%

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

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

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

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

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

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

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

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

    if 3.09999999999999988e-81 < b

    1. Initial program 14.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-neg14.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-neg14.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*14.5%

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

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

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

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

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

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

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

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

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

Alternative 6: 67.1% accurate, 6.8× speedup?

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

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

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


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

    1. Initial program 70.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-neg70.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-neg70.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*70.5%

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

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

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

    if -9.999999999999969e-311 < b

    1. Initial program 30.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{c \cdot -0.5}}{b} \]
    9. Simplified66.6%

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

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

Alternative 7: 67.0% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 70.7%

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

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

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

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

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

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

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

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

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

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

    if 1.79999999999999996e-306 < b

    1. Initial program 30.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-neg30.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-neg30.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*30.2%

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

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

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

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

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

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

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

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

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

Alternative 8: 67.0% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 70.7%

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

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

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

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

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

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

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

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

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

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

    if 2.54999999999999986e-306 < b

    1. Initial program 30.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-neg30.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-neg30.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*30.2%

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

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

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

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

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

Alternative 9: 67.0% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 70.7%

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

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

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

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

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

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

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

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

    if 1.79999999999999996e-306 < b

    1. Initial program 30.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-neg30.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-neg30.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*30.2%

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

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

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

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

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

Alternative 10: 66.9% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 70.7%

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

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

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

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

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

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

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

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

    if 1.79999999999999996e-306 < b

    1. Initial program 30.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-neg30.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-neg30.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*30.2%

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a} \]
    6. Step-by-step derivation
      1. associate-*r/49.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{c \cdot -0.5}}{b} \]
      3. metadata-eval67.1%

        \[\leadsto \frac{c \cdot \color{blue}{\left(0.16666666666666666 \cdot -3\right)}}{b} \]
      4. rem-square-sqrt0.0%

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

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

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

        \[\leadsto c \cdot \frac{0.16666666666666666 \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{b} \]
      8. rem-square-sqrt66.9%

        \[\leadsto c \cdot \frac{0.16666666666666666 \cdot \color{blue}{-3}}{b} \]
      9. metadata-eval66.9%

        \[\leadsto c \cdot \frac{\color{blue}{-0.5}}{b} \]
    11. Simplified66.9%

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

Alternative 11: 66.9% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 70.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} \]
      2. *-commutative73.6%

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

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

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

    if 1.79999999999999996e-306 < b

    1. Initial program 30.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-neg30.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-neg30.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*30.2%

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a} \]
    6. Step-by-step derivation
      1. associate-*r/49.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{c \cdot -0.5}}{b} \]
      3. metadata-eval67.1%

        \[\leadsto \frac{c \cdot \color{blue}{\left(0.16666666666666666 \cdot -3\right)}}{b} \]
      4. rem-square-sqrt0.0%

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

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

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

        \[\leadsto c \cdot \frac{0.16666666666666666 \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{b} \]
      8. rem-square-sqrt66.9%

        \[\leadsto c \cdot \frac{0.16666666666666666 \cdot \color{blue}{-3}}{b} \]
      9. metadata-eval66.9%

        \[\leadsto c \cdot \frac{\color{blue}{-0.5}}{b} \]
    11. Simplified66.9%

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

Alternative 12: 41.8% accurate, 11.6× speedup?

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} \]
      2. *-commutative53.4%

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

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

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

    if 3.30000000000000013e-46 < b

    1. Initial program 14.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-neg14.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-neg14.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*14.1%

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a} \]
    6. Step-by-step derivation
      1. associate-*r/65.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{a \cdot \left(\left(c \cdot \frac{-1.5}{b}\right) \cdot \frac{-0.3333333333333333}{a}\right)} \]
    10. Step-by-step derivation
      1. associate-*r*19.1%

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

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

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

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

        \[\leadsto \left(\left(c \cdot a\right) \cdot \color{blue}{\left(-1.5 \cdot \frac{1}{b}\right)}\right) \cdot \frac{-0.3333333333333333}{a} \]
      6. associate-*r*19.0%

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

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

        \[\leadsto \left(\color{blue}{\left(-1.5 \cdot \left(a \cdot c\right)\right)} \cdot \frac{1}{b}\right) \cdot \frac{-0.3333333333333333}{a} \]
      9. associate-*r*19.0%

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

        \[\leadsto \left(\color{blue}{\left(c \cdot \left(-1.5 \cdot a\right)\right)} \cdot \frac{1}{b}\right) \cdot \frac{-0.3333333333333333}{a} \]
      11. associate-*r*18.9%

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

        \[\leadsto \left(c \cdot \color{blue}{\left(a \cdot -1.5\right)}\right) \cdot \left(\frac{1}{b} \cdot \frac{-0.3333333333333333}{a}\right) \]
      13. associate-*l/18.9%

        \[\leadsto \left(c \cdot \left(a \cdot -1.5\right)\right) \cdot \color{blue}{\frac{1 \cdot \frac{-0.3333333333333333}{a}}{b}} \]
      14. *-lft-identity18.9%

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

      \[\leadsto \color{blue}{\left(c \cdot \left(a \cdot -1.5\right)\right) \cdot \frac{\frac{-0.3333333333333333}{a}}{b}} \]
    12. Taylor expanded in c around 0 18.9%

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

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

Alternative 13: 10.2% accurate, 23.2× speedup?

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

\\
\frac{c}{b} \cdot 0.5
\end{array}
Derivation
  1. Initial program 48.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-neg48.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-neg48.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*48.4%

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

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

    \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a} \]
  6. Step-by-step derivation
    1. associate-*r/28.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto a \cdot \left(\left(c \cdot \frac{-1.5}{b}\right) \cdot \frac{1}{\sqrt{\left(a \cdot a\right) \cdot \color{blue}{9}}}\right) \]
    11. metadata-eval14.1%

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

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

      \[\leadsto a \cdot \left(\left(c \cdot \frac{-1.5}{b}\right) \cdot \frac{1}{\color{blue}{\sqrt{a \cdot -3} \cdot \sqrt{a \cdot -3}}}\right) \]
    14. add-sqr-sqrt9.3%

      \[\leadsto a \cdot \left(\left(c \cdot \frac{-1.5}{b}\right) \cdot \frac{1}{\color{blue}{a \cdot -3}}\right) \]
    15. *-commutative9.3%

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

      \[\leadsto a \cdot \left(\left(c \cdot \frac{-1.5}{b}\right) \cdot \color{blue}{\frac{\frac{1}{-3}}{a}}\right) \]
    17. metadata-eval9.3%

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

    \[\leadsto \color{blue}{a \cdot \left(\left(c \cdot \frac{-1.5}{b}\right) \cdot \frac{-0.3333333333333333}{a}\right)} \]
  10. Step-by-step derivation
    1. associate-*r*9.0%

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

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

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

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

      \[\leadsto \left(\left(c \cdot a\right) \cdot \color{blue}{\left(-1.5 \cdot \frac{1}{b}\right)}\right) \cdot \frac{-0.3333333333333333}{a} \]
    6. associate-*r*8.9%

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

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

      \[\leadsto \left(\color{blue}{\left(-1.5 \cdot \left(a \cdot c\right)\right)} \cdot \frac{1}{b}\right) \cdot \frac{-0.3333333333333333}{a} \]
    9. associate-*r*8.9%

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

      \[\leadsto \left(\color{blue}{\left(c \cdot \left(-1.5 \cdot a\right)\right)} \cdot \frac{1}{b}\right) \cdot \frac{-0.3333333333333333}{a} \]
    11. associate-*r*8.6%

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

      \[\leadsto \left(c \cdot \color{blue}{\left(a \cdot -1.5\right)}\right) \cdot \left(\frac{1}{b} \cdot \frac{-0.3333333333333333}{a}\right) \]
    13. associate-*l/8.6%

      \[\leadsto \left(c \cdot \left(a \cdot -1.5\right)\right) \cdot \color{blue}{\frac{1 \cdot \frac{-0.3333333333333333}{a}}{b}} \]
    14. *-lft-identity8.6%

      \[\leadsto \left(c \cdot \left(a \cdot -1.5\right)\right) \cdot \frac{\color{blue}{\frac{-0.3333333333333333}{a}}}{b} \]
  11. Simplified8.6%

    \[\leadsto \color{blue}{\left(c \cdot \left(a \cdot -1.5\right)\right) \cdot \frac{\frac{-0.3333333333333333}{a}}{b}} \]
  12. Taylor expanded in c around 0 8.9%

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

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

Reproduce

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