Cubic critical

Percentage Accurate: 51.6% → 84.6%
Time: 22.6s
Alternatives: 19
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 19 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.6% accurate, 1.0× speedup?

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

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

Alternative 1: 84.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.8 \cdot 10^{+64}:\\ \;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\ \mathbf{elif}\;b \leq 7.4 \cdot 10^{-110}:\\ \;\;\;\;\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 -1.8e+64)
   (/ (* b -0.6666666666666666) a)
   (if (<= b 7.4e-110)
     (/ (- (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 <= -1.8e+64) {
		tmp = (b * -0.6666666666666666) / a;
	} else if (b <= 7.4e-110) {
		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 <= (-1.8d+64)) then
        tmp = (b * (-0.6666666666666666d0)) / a
    else if (b <= 7.4d-110) 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 <= -1.8e+64) {
		tmp = (b * -0.6666666666666666) / a;
	} else if (b <= 7.4e-110) {
		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 <= -1.8e+64:
		tmp = (b * -0.6666666666666666) / a
	elif b <= 7.4e-110:
		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 <= -1.8e+64)
		tmp = Float64(Float64(b * -0.6666666666666666) / a);
	elseif (b <= 7.4e-110)
		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 <= -1.8e+64)
		tmp = (b * -0.6666666666666666) / a;
	elseif (b <= 7.4e-110)
		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, -1.8e+64], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 7.4e-110], 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 -1.8 \cdot 10^{+64}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\

\mathbf{elif}\;b \leq 7.4 \cdot 10^{-110}:\\
\;\;\;\;\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 < -1.80000000000000007e64

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

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

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

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

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

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

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

    if -1.80000000000000007e64 < b < 7.40000000000000032e-110

    1. Initial program 85.2%

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

    if 7.40000000000000032e-110 < b

    1. Initial program 12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.8 \cdot 10^{+64}:\\ \;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\ \mathbf{elif}\;b \leq 7.4 \cdot 10^{-110}:\\ \;\;\;\;\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: 84.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -6.2 \cdot 10^{+63}:\\ \;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-109}:\\ \;\;\;\;\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 -6.2e+63)
   (/ (* b -0.6666666666666666) a)
   (if (<= b 4e-109)
     (/ (- (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 <= -6.2e+63) {
		tmp = (b * -0.6666666666666666) / a;
	} else if (b <= 4e-109) {
		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 <= (-6.2d+63)) then
        tmp = (b * (-0.6666666666666666d0)) / a
    else if (b <= 4d-109) 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 <= -6.2e+63) {
		tmp = (b * -0.6666666666666666) / a;
	} else if (b <= 4e-109) {
		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 <= -6.2e+63:
		tmp = (b * -0.6666666666666666) / a
	elif b <= 4e-109:
		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 <= -6.2e+63)
		tmp = Float64(Float64(b * -0.6666666666666666) / a);
	elseif (b <= 4e-109)
		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 <= -6.2e+63)
		tmp = (b * -0.6666666666666666) / a;
	elseif (b <= 4e-109)
		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, -6.2e+63], N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b, 4e-109], 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 -6.2 \cdot 10^{+63}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\

\mathbf{elif}\;b \leq 4 \cdot 10^{-109}:\\
\;\;\;\;\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 < -6.2000000000000001e63

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

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

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

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

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

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

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

    if -6.2000000000000001e63 < b < 4e-109

    1. Initial program 85.2%

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

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

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

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

    1. Initial program 12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.2 \cdot 10^{+63}:\\ \;\;\;\;\frac{b \cdot -0.6666666666666666}{a}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-109}:\\ \;\;\;\;\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: 79.5% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 7 \cdot 10^{-109}:\\
\;\;\;\;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 < -2.3500000000000001e-129

    1. Initial program 74.6%

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

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

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

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. fma-define84.0%

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

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

    if -2.3500000000000001e-129 < b < 7e-109

    1. Initial program 77.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7e-109 < b

    1. Initial program 12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.35 \cdot 10^{-129}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 7 \cdot 10^{-109}:\\ \;\;\;\;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 4: 79.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 74.6%

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

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

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

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. fma-define84.0%

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

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

    if -2.7499999999999999e-125 < b < 6.59999999999999981e-109

    1. Initial program 77.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.59999999999999981e-109 < b

    1. Initial program 12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.75 \cdot 10^{-125}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 6.6 \cdot 10^{-109}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 79.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 74.6%

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

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

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

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. fma-define84.0%

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

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

    if -2.7499999999999999e-125 < b < 7e-109

    1. Initial program 77.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{b + \sqrt{\left(a \cdot -3\right) \cdot c}}{a}} \]
    12. Step-by-step derivation
      1. clear-num76.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7e-109 < b

    1. Initial program 12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.75 \cdot 10^{-125}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 7 \cdot 10^{-109}:\\ \;\;\;\;\left(b + \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 79.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 7 \cdot 10^{-109}:\\
\;\;\;\;\frac{0.3333333333333333 \cdot \left(b + \sqrt{\left(a \cdot c\right) \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 < -5.0000000000000003e-124

    1. Initial program 74.6%

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

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

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

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. fma-define84.0%

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

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

    if -5.0000000000000003e-124 < b < 7e-109

    1. Initial program 77.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7e-109 < b

    1. Initial program 12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-124}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 7 \cdot 10^{-109}:\\ \;\;\;\;\frac{0.3333333333333333 \cdot \left(b + \sqrt{\left(a \cdot c\right) \cdot -3}\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 79.4% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 2.3 \cdot 10^{-109}:\\
\;\;\;\;\frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{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 < -4.50000000000000031e-129

    1. Initial program 74.6%

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

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

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

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. fma-define84.0%

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

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

    if -4.50000000000000031e-129 < b < 2.3000000000000001e-109

    1. Initial program 77.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.3000000000000001e-109 < b

    1. Initial program 12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.5 \cdot 10^{-129}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 2.3 \cdot 10^{-109}:\\ \;\;\;\;\frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 79.8% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 3.8 \cdot 10^{-109}:\\
\;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - 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.99999999999999973e-124

    1. Initial program 74.6%

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

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

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

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. fma-define84.0%

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

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

    if -3.99999999999999973e-124 < b < 3.80000000000000002e-109

    1. Initial program 77.0%

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

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

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

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

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

    if 3.80000000000000002e-109 < b

    1. Initial program 12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{-124}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 3.8 \cdot 10^{-109}:\\ \;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 79.8% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 8 \cdot 10^{-110}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \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 < -5.0000000000000003e-124

    1. Initial program 74.6%

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

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

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

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. fma-define84.0%

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

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

    if -5.0000000000000003e-124 < b < 8.0000000000000004e-110

    1. Initial program 77.0%

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

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

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

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

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

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

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

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

    if 8.0000000000000004e-110 < b

    1. Initial program 12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-124}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 8 \cdot 10^{-110}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 79.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-124}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 7 \cdot 10^{-109}:\\ \;\;\;\;\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 -5e-124)
   (fma -0.6666666666666666 (/ b a) (* 0.5 (/ c b)))
   (if (<= b 7e-109)
     (/ (- (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 <= -5e-124) {
		tmp = fma(-0.6666666666666666, (b / a), (0.5 * (c / b)));
	} else if (b <= 7e-109) {
		tmp = (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 <= -5e-124)
		tmp = fma(-0.6666666666666666, Float64(b / a), Float64(0.5 * Float64(c / b)));
	elseif (b <= 7e-109)
		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
code[a_, b_, c_] := If[LessEqual[b, -5e-124], N[(-0.6666666666666666 * N[(b / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7e-109], 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 -5 \cdot 10^{-124}:\\
\;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\

\mathbf{elif}\;b \leq 7 \cdot 10^{-109}:\\
\;\;\;\;\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 < -5.0000000000000003e-124

    1. Initial program 74.6%

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

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

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

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. fma-define84.0%

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

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

    if -5.0000000000000003e-124 < b < 7e-109

    1. Initial program 77.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if 7e-109 < b

    1. Initial program 12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-124}:\\ \;\;\;\;\mathsf{fma}\left(-0.6666666666666666, \frac{b}{a}, 0.5 \cdot \frac{c}{b}\right)\\ \mathbf{elif}\;b \leq 7 \cdot 10^{-109}:\\ \;\;\;\;\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 11: 67.5% accurate, 1.0× speedup?

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

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


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

    1. Initial program 77.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-neg77.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-neg77.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*77.4%

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. fma-define70.3%

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

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

    if -4.999999999999985e-310 < b

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

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

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

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

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

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

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

Alternative 12: 67.5% accurate, 7.2× speedup?

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

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

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


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

    1. Initial program 77.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-neg77.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-neg77.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*77.4%

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

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

    if -4.999999999999985e-310 < b

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

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

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

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

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

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

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

Alternative 13: 67.3% accurate, 11.6× speedup?

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

    1. Initial program 77.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-neg77.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-neg77.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*77.4%

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

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

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

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

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

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

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

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

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

    if 1.4000000000000002e-308 < b

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{a \cdot \frac{c}{b}}{a} \cdot \frac{-1.5}{3}} \]
      4. metadata-eval57.3%

        \[\leadsto \frac{a \cdot \frac{c}{b}}{a} \cdot \color{blue}{-0.5} \]
    9. Applied egg-rr57.3%

      \[\leadsto \color{blue}{\frac{a \cdot \frac{c}{b}}{a} \cdot -0.5} \]
    10. Step-by-step derivation
      1. expm1-log1p-u49.9%

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{a \cdot \frac{\frac{c}{b}}{a}}\right)} - 1\right) \cdot -0.5 \]
    11. Applied egg-rr27.1%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(a \cdot \frac{\frac{c}{b}}{a}\right)} - 1\right)} \cdot -0.5 \]
    12. Step-by-step derivation
      1. expm1-define53.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot \frac{\frac{c}{b}}{a}\right)\right)} \cdot -0.5 \]
      2. associate-*r/49.9%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\frac{a \cdot \frac{c}{b}}{a}}\right)\right) \cdot -0.5 \]
      3. *-commutative49.9%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\color{blue}{\frac{c}{b} \cdot a}}{a}\right)\right) \cdot -0.5 \]
      4. associate-*r/58.2%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\frac{c}{b} \cdot \frac{a}{a}}\right)\right) \cdot -0.5 \]
      5. *-inverses58.2%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{b} \cdot \color{blue}{1}\right)\right) \cdot -0.5 \]
      6. *-rgt-identity58.2%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\frac{c}{b}}\right)\right) \cdot -0.5 \]
    13. Simplified58.2%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{b}\right)\right)} \cdot -0.5 \]
    14. Taylor expanded in c around 0 65.6%

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

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

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

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

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

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

Alternative 14: 67.3% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 77.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-neg77.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-neg77.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*77.4%

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

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

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

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

    if 1.9999999999999988e-309 < b

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{a \cdot \frac{c}{b}}{a} \cdot \frac{-1.5}{3}} \]
      4. metadata-eval57.3%

        \[\leadsto \frac{a \cdot \frac{c}{b}}{a} \cdot \color{blue}{-0.5} \]
    9. Applied egg-rr57.3%

      \[\leadsto \color{blue}{\frac{a \cdot \frac{c}{b}}{a} \cdot -0.5} \]
    10. Step-by-step derivation
      1. expm1-log1p-u49.9%

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{a \cdot \frac{\frac{c}{b}}{a}}\right)} - 1\right) \cdot -0.5 \]
    11. Applied egg-rr27.1%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(a \cdot \frac{\frac{c}{b}}{a}\right)} - 1\right)} \cdot -0.5 \]
    12. Step-by-step derivation
      1. expm1-define53.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot \frac{\frac{c}{b}}{a}\right)\right)} \cdot -0.5 \]
      2. associate-*r/49.9%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\frac{a \cdot \frac{c}{b}}{a}}\right)\right) \cdot -0.5 \]
      3. *-commutative49.9%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\color{blue}{\frac{c}{b} \cdot a}}{a}\right)\right) \cdot -0.5 \]
      4. associate-*r/58.2%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\frac{c}{b} \cdot \frac{a}{a}}\right)\right) \cdot -0.5 \]
      5. *-inverses58.2%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{b} \cdot \color{blue}{1}\right)\right) \cdot -0.5 \]
      6. *-rgt-identity58.2%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\frac{c}{b}}\right)\right) \cdot -0.5 \]
    13. Simplified58.2%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{b}\right)\right)} \cdot -0.5 \]
    14. Taylor expanded in c around 0 65.6%

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

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

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

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

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

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

Alternative 15: 67.3% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 77.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-neg77.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-neg77.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*77.4%

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

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

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

      \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
    8. Step-by-step derivation
      1. add-cbrt-cube37.3%

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

        \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{b}{a} \cdot -0.6666666666666666\right)}^{3}}} \]
      3. associate-*l/37.4%

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

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{b \cdot -0.6666666666666666}{a}\right)}^{3}}} \]
    10. Step-by-step derivation
      1. rem-cbrt-cube70.3%

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

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{b \cdot -0.6666666666666666}}} \]
      3. *-un-lft-identity70.2%

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

        \[\leadsto \frac{1}{\frac{1 \cdot a}{\color{blue}{-0.6666666666666666 \cdot b}}} \]
      5. times-frac70.2%

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

        \[\leadsto \frac{1}{\color{blue}{-1.5} \cdot \frac{a}{b}} \]
    11. Applied egg-rr70.2%

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

        \[\leadsto \color{blue}{\frac{\frac{1}{-1.5}}{\frac{a}{b}}} \]
      2. metadata-eval70.2%

        \[\leadsto \frac{\color{blue}{-0.6666666666666666}}{\frac{a}{b}} \]
    13. Simplified70.2%

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

    if -4.999999999999985e-310 < b

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{a \cdot \frac{c}{b}}{a} \cdot \frac{-1.5}{3}} \]
      4. metadata-eval57.3%

        \[\leadsto \frac{a \cdot \frac{c}{b}}{a} \cdot \color{blue}{-0.5} \]
    9. Applied egg-rr57.3%

      \[\leadsto \color{blue}{\frac{a \cdot \frac{c}{b}}{a} \cdot -0.5} \]
    10. Step-by-step derivation
      1. expm1-log1p-u49.9%

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{a \cdot \frac{\frac{c}{b}}{a}}\right)} - 1\right) \cdot -0.5 \]
    11. Applied egg-rr27.1%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(a \cdot \frac{\frac{c}{b}}{a}\right)} - 1\right)} \cdot -0.5 \]
    12. Step-by-step derivation
      1. expm1-define53.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot \frac{\frac{c}{b}}{a}\right)\right)} \cdot -0.5 \]
      2. associate-*r/49.9%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\frac{a \cdot \frac{c}{b}}{a}}\right)\right) \cdot -0.5 \]
      3. *-commutative49.9%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\color{blue}{\frac{c}{b} \cdot a}}{a}\right)\right) \cdot -0.5 \]
      4. associate-*r/58.2%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\frac{c}{b} \cdot \frac{a}{a}}\right)\right) \cdot -0.5 \]
      5. *-inverses58.2%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{b} \cdot \color{blue}{1}\right)\right) \cdot -0.5 \]
      6. *-rgt-identity58.2%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\frac{c}{b}}\right)\right) \cdot -0.5 \]
    13. Simplified58.2%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{b}\right)\right)} \cdot -0.5 \]
    14. Taylor expanded in c around 0 65.6%

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

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

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

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

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

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

Alternative 16: 67.3% accurate, 11.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{b \cdot -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 < -4.999999999999985e-310

    1. Initial program 77.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-neg77.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-neg77.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*77.4%

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

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

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

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

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

    if -4.999999999999985e-310 < b

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{a \cdot \frac{c}{b}}{a} \cdot \frac{-1.5}{3}} \]
      4. metadata-eval57.3%

        \[\leadsto \frac{a \cdot \frac{c}{b}}{a} \cdot \color{blue}{-0.5} \]
    9. Applied egg-rr57.3%

      \[\leadsto \color{blue}{\frac{a \cdot \frac{c}{b}}{a} \cdot -0.5} \]
    10. Step-by-step derivation
      1. expm1-log1p-u49.9%

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

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

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{a \cdot \frac{\frac{c}{b}}{a}}\right)} - 1\right) \cdot -0.5 \]
    11. Applied egg-rr27.1%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(a \cdot \frac{\frac{c}{b}}{a}\right)} - 1\right)} \cdot -0.5 \]
    12. Step-by-step derivation
      1. expm1-define53.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(a \cdot \frac{\frac{c}{b}}{a}\right)\right)} \cdot -0.5 \]
      2. associate-*r/49.9%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\frac{a \cdot \frac{c}{b}}{a}}\right)\right) \cdot -0.5 \]
      3. *-commutative49.9%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\color{blue}{\frac{c}{b} \cdot a}}{a}\right)\right) \cdot -0.5 \]
      4. associate-*r/58.2%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\frac{c}{b} \cdot \frac{a}{a}}\right)\right) \cdot -0.5 \]
      5. *-inverses58.2%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{b} \cdot \color{blue}{1}\right)\right) \cdot -0.5 \]
      6. *-rgt-identity58.2%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\frac{c}{b}}\right)\right) \cdot -0.5 \]
    13. Simplified58.2%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{b}\right)\right)} \cdot -0.5 \]
    14. Taylor expanded in c around 0 65.6%

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

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

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

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

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

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

Alternative 17: 67.4% accurate, 11.6× speedup?

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

    1. Initial program 77.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-neg77.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-neg77.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*77.4%

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

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

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

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

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

    if -4.999999999999985e-310 < b

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

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

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

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

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

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

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

Alternative 18: 15.2% accurate, 23.2× speedup?

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

\\
\frac{b}{a} \cdot -0.3333333333333333
\end{array}
Derivation
  1. Initial program 55.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-neg55.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-neg55.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*55.2%

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

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

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

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

    \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{b}{a}} \]
  9. Final simplification14.7%

    \[\leadsto \frac{b}{a} \cdot -0.3333333333333333 \]
  10. Add Preprocessing

Alternative 19: 34.9% accurate, 23.2× speedup?

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

\\
b \cdot \frac{-0.6666666666666666}{a}
\end{array}
Derivation
  1. Initial program 55.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-neg55.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-neg55.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*55.2%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
  11. Final simplification37.8%

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

Reproduce

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