Cubic critical

Percentage Accurate: 52.1% → 85.0%
Time: 13.6s
Alternatives: 13
Speedup: 16.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 52.1% accurate, 1.0× speedup?

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

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

Alternative 1: 85.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 63.6%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around -inf 98.3%

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

        \[\leadsto \frac{\color{blue}{b \cdot -2}}{3 \cdot a} \]
    4. Simplified98.3%

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

    if -3.6e112 < b < 4.20000000000000019e-100

    1. Initial program 81.4%

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

    if 4.20000000000000019e-100 < b

    1. Initial program 9.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. /-rgt-identity9.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{\color{blue}{-3 \cdot a}} \]
      12. distribute-rgt-neg-in9.6%

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

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

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

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

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

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

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

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

        \[\leadsto -0.3333333333333333 \cdot \frac{b - \sqrt{b \cdot b + \color{blue}{\left(-3\right)} \cdot \left(a \cdot c\right)}}{a} \]
      5. cancel-sign-sub-inv9.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.6 \cdot 10^{+112}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 4.2 \cdot 10^{-100}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 2: 84.9% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 63.6%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around -inf 98.3%

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

        \[\leadsto \frac{\color{blue}{b \cdot -2}}{3 \cdot a} \]
    4. Simplified98.3%

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

    if -3.70000000000000004e112 < b < 8.50000000000000017e-100

    1. Initial program 81.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. /-rgt-identity81.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.50000000000000017e-100 < b

    1. Initial program 9.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. /-rgt-identity9.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{\color{blue}{-3 \cdot a}} \]
      12. distribute-rgt-neg-in9.6%

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

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

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

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

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

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

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

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

        \[\leadsto -0.3333333333333333 \cdot \frac{b - \sqrt{b \cdot b + \color{blue}{\left(-3\right)} \cdot \left(a \cdot c\right)}}{a} \]
      5. cancel-sign-sub-inv9.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.7 \cdot 10^{+112}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{-100}:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 3: 85.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 63.6%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around -inf 98.3%

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

        \[\leadsto \frac{\color{blue}{b \cdot -2}}{3 \cdot a} \]
    4. Simplified98.3%

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

    if -1.61999999999999994e112 < b < 8.59999999999999997e-100

    1. Initial program 81.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. associate-*r*81.3%

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

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

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

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

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

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

    if 8.59999999999999997e-100 < b

    1. Initial program 9.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. /-rgt-identity9.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{\color{blue}{-3 \cdot a}} \]
      12. distribute-rgt-neg-in9.6%

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

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

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

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

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

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

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

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

        \[\leadsto -0.3333333333333333 \cdot \frac{b - \sqrt{b \cdot b + \color{blue}{\left(-3\right)} \cdot \left(a \cdot c\right)}}{a} \]
      5. cancel-sign-sub-inv9.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.62 \cdot 10^{+112}:\\ \;\;\;\;\frac{b \cdot -2}{3 \cdot a}\\ \mathbf{elif}\;b \leq 8.6 \cdot 10^{-100}:\\ \;\;\;\;\frac{\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 4: 79.4% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 3.8 \cdot 10^{-100}:\\
\;\;\;\;\left(\sqrt{c \cdot \left(a \cdot -3\right)} - b\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 < -64000

    1. Initial program 71.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around -inf 92.8%

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. associate-*r/92.9%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} + 0.5 \cdot \frac{c}{b} \]
    4. Applied egg-rr92.9%

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

    if -64000 < b < 3.79999999999999997e-100

    1. Initial program 78.1%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around 0 67.6%

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\left(-b\right) + \sqrt{-3 \cdot \left(c \cdot a\right)}}{3 \cdot a}\right)} - 1} \]
      3. neg-mul-117.2%

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\mathsf{fma}\left(-1, b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}{3 \cdot a}\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def50.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.79999999999999997e-100 < b

    1. Initial program 9.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. /-rgt-identity9.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{\color{blue}{-3 \cdot a}} \]
      12. distribute-rgt-neg-in9.6%

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

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

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

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

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

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

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

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

        \[\leadsto -0.3333333333333333 \cdot \frac{b - \sqrt{b \cdot b + \color{blue}{\left(-3\right)} \cdot \left(a \cdot c\right)}}{a} \]
      5. cancel-sign-sub-inv9.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -64000:\\ \;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 3.8 \cdot 10^{-100}:\\ \;\;\;\;\left(\sqrt{c \cdot \left(a \cdot -3\right)} - b\right) \cdot \frac{0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 5: 79.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 71.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around -inf 92.8%

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. associate-*r/92.9%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} + 0.5 \cdot \frac{c}{b} \]
    4. Applied egg-rr92.9%

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

    if -4.4e5 < b < 6.1999999999999997e-100

    1. Initial program 78.1%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around 0 67.6%

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

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

        \[\leadsto \frac{\color{blue}{e^{\mathsf{log1p}\left(\left(-b\right) + \sqrt{-3 \cdot \left(c \cdot a\right)}\right)} - 1}}{3 \cdot a} \]
      3. neg-mul-138.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.1999999999999997e-100 < b

    1. Initial program 9.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. /-rgt-identity9.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{\color{blue}{-3 \cdot a}} \]
      12. distribute-rgt-neg-in9.6%

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

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

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

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

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

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

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

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

        \[\leadsto -0.3333333333333333 \cdot \frac{b - \sqrt{b \cdot b + \color{blue}{\left(-3\right)} \cdot \left(a \cdot c\right)}}{a} \]
      5. cancel-sign-sub-inv9.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -440000:\\ \;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 6.2 \cdot 10^{-100}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 6: 79.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -220000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{c}{\frac{b}{a}} \cdot 1.5\right)}{3 \cdot a}\\

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

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


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

    1. Initial program 72.6%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around -inf 91.6%

      \[\leadsto \frac{\color{blue}{1.5 \cdot \frac{c \cdot a}{b} + -2 \cdot b}}{3 \cdot a} \]
    3. Step-by-step derivation
      1. +-commutative91.6%

        \[\leadsto \frac{\color{blue}{-2 \cdot b + 1.5 \cdot \frac{c \cdot a}{b}}}{3 \cdot a} \]
      2. *-commutative91.6%

        \[\leadsto \frac{\color{blue}{b \cdot -2} + 1.5 \cdot \frac{c \cdot a}{b}}{3 \cdot a} \]
      3. fma-def91.6%

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

        \[\leadsto \frac{\mathsf{fma}\left(b, -2, \color{blue}{\frac{c \cdot a}{b} \cdot 1.5}\right)}{3 \cdot a} \]
      5. associate-/l*94.1%

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

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

    if -2.2e8 < b < 1.1499999999999999e-99

    1. Initial program 77.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around 0 66.9%

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

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

        \[\leadsto \frac{\color{blue}{e^{\mathsf{log1p}\left(\left(-b\right) + \sqrt{-3 \cdot \left(c \cdot a\right)}\right)} - 1}}{3 \cdot a} \]
      3. neg-mul-138.4%

        \[\leadsto \frac{e^{\mathsf{log1p}\left(\color{blue}{-1 \cdot b} + \sqrt{-3 \cdot \left(c \cdot a\right)}\right)} - 1}{3 \cdot a} \]
      4. fma-def38.4%

        \[\leadsto \frac{e^{\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{-3 \cdot \left(c \cdot a\right)}\right)}\right)} - 1}{3 \cdot a} \]
      5. *-commutative38.4%

        \[\leadsto \frac{e^{\mathsf{log1p}\left(\mathsf{fma}\left(-1, b, \sqrt{-3 \cdot \color{blue}{\left(a \cdot c\right)}}\right)\right)} - 1}{3 \cdot a} \]
      6. *-commutative38.4%

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

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

      \[\leadsto \frac{\color{blue}{e^{\mathsf{log1p}\left(\mathsf{fma}\left(-1, b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)} - 1}}{3 \cdot a} \]
    5. Step-by-step derivation
      1. expm1-def64.6%

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

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

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

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

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

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

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

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

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

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

    if 1.1499999999999999e-99 < b

    1. Initial program 9.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. /-rgt-identity9.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{\color{blue}{-3 \cdot a}} \]
      12. distribute-rgt-neg-in9.6%

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

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

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

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

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

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

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

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

        \[\leadsto -0.3333333333333333 \cdot \frac{b - \sqrt{b \cdot b + \color{blue}{\left(-3\right)} \cdot \left(a \cdot c\right)}}{a} \]
      5. cancel-sign-sub-inv9.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -220000000:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{c}{\frac{b}{a}} \cdot 1.5\right)}{3 \cdot a}\\ \mathbf{elif}\;b \leq 1.15 \cdot 10^{-99}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 7: 66.8% accurate, 8.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} + \frac{b}{a} \cdot -0.6666666666666666\\ \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)) (* (/ b a) -0.6666666666666666))
   (/ (* c -0.5) b)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5e-310) {
		tmp = (0.5 * (c / b)) + ((b / a) * -0.6666666666666666);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-5d-310)) then
        tmp = (0.5d0 * (c / b)) + ((b / a) * (-0.6666666666666666d0))
    else
        tmp = (c * (-0.5d0)) / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -5e-310) {
		tmp = (0.5 * (c / b)) + ((b / a) * -0.6666666666666666);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -5e-310:
		tmp = (0.5 * (c / b)) + ((b / a) * -0.6666666666666666)
	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(Float64(b / a) * -0.6666666666666666));
	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)) + ((b / a) * -0.6666666666666666);
	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[(N[(b / a), $MachinePrecision] * -0.6666666666666666), $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} + \frac{b}{a} \cdot -0.6666666666666666\\

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

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around -inf 64.3%

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

    if -4.999999999999985e-310 < b

    1. Initial program 22.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. /-rgt-identity22.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    8. Simplified71.3%

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

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

Alternative 8: 66.8% accurate, 8.9× speedup?

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

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


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

    1. Initial program 77.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around -inf 64.3%

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    3. Step-by-step derivation
      1. associate-*r/64.4%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} + 0.5 \cdot \frac{c}{b} \]
    4. Applied egg-rr64.4%

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

    if -4.999999999999985e-310 < b

    1. Initial program 22.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. /-rgt-identity22.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    8. Simplified71.3%

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

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

Alternative 9: 66.7% accurate, 12.8× speedup?

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

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around -inf 64.3%

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

        \[\leadsto \frac{\color{blue}{b \cdot -2}}{3 \cdot a} \]
    4. Simplified64.3%

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

    if -4.999999999999985e-310 < b

    1. Initial program 22.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. /-rgt-identity22.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    8. Simplified71.3%

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

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

Alternative 10: 66.7% accurate, 16.4× speedup?

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

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

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


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

    1. Initial program 77.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around -inf 64.2%

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

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

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

    if 9.0000000000000021e-309 < b

    1. Initial program 22.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around inf 71.3%

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

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

Alternative 11: 66.7% accurate, 16.4× speedup?

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

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

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


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

    1. Initial program 77.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{\color{blue}{-3 \cdot a}} \]
      12. distribute-rgt-neg-in77.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 22.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around inf 71.3%

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

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

Alternative 12: 66.7% accurate, 16.4× 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.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{\color{blue}{-3 \cdot a}} \]
      12. distribute-rgt-neg-in77.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 22.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. /-rgt-identity22.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    8. Simplified71.3%

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

    \[\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} \]

Alternative 13: 34.6% accurate, 23.2× speedup?

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

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Taylor expanded in b around inf 33.2%

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
  3. Final simplification33.2%

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

Reproduce

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