Cubic critical

Percentage Accurate: 51.3% → 84.7%
Time: 12.1s
Alternatives: 10
Speedup: 11.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 51.3% accurate, 1.0× speedup?

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

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

Alternative 1: 84.7% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 57.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{\color{blue}{0.3333333333333333}}{a} + \left(-\frac{b}{3 \cdot a}\right) \]
      9. div-inv52.6%

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-\color{blue}{b \cdot \frac{1}{3 \cdot a}}\right) \]
      10. associate-/r*52.6%

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-b \cdot \color{blue}{\frac{\frac{1}{3}}{a}}\right) \]
      11. metadata-eval52.6%

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

      \[\leadsto \color{blue}{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-b \cdot \frac{0.3333333333333333}{a}\right)} \]
    7. Step-by-step derivation
      1. distribute-lft-neg-in52.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{0.3333333333333333 \cdot \left(\mathsf{hypot}\left(b, \sqrt{\left(a \cdot -3\right) \cdot c}\right) - b\right)}}} \]
      3. associate-*l*52.7%

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

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

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

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

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

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

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(-0.6666666666666666 \cdot b\right)} \]
    14. Step-by-step derivation
      1. *-commutative96.7%

        \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(b \cdot -0.6666666666666666\right)} \]
    15. Simplified96.7%

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

    if -1.40000000000000004e56 < b < 1.5000000000000001e-154

    1. Initial program 82.0%

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

    if 1.5000000000000001e-154 < b

    1. Initial program 21.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    7. Applied egg-rr83.8%

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

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

Alternative 2: 80.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 62.9%

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

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

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

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

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

    if -3.4999999999999999e-58 < b < 1.48e-154

    1. Initial program 82.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-identity82.8%

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

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

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

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

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

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

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

    if 1.48e-154 < b

    1. Initial program 21.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    7. Applied egg-rr83.8%

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

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

Alternative 3: 80.2% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 62.9%

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. div-sub62.9%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-\color{blue}{b \cdot \frac{1}{3 \cdot a}}\right) \]
      10. associate-/r*52.0%

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-b \cdot \color{blue}{\frac{\frac{1}{3}}{a}}\right) \]
      11. metadata-eval52.0%

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

      \[\leadsto \color{blue}{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-b \cdot \frac{0.3333333333333333}{a}\right)} \]
    7. Step-by-step derivation
      1. distribute-lft-neg-in52.0%

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \color{blue}{\left(-b\right) \cdot \frac{0.3333333333333333}{a}} \]
      2. distribute-rgt-in52.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{0.3333333333333333 \cdot \left(\mathsf{hypot}\left(b, \sqrt{\left(a \cdot -3\right) \cdot c}\right) - b\right)}}} \]
      3. associate-*l*52.1%

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

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

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

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

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

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

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(-0.6666666666666666 \cdot b\right)} \]
    14. Step-by-step derivation
      1. *-commutative87.2%

        \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(b \cdot -0.6666666666666666\right)} \]
    15. Simplified87.2%

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

    if -4.1999999999999999e-57 < b < 1.5000000000000001e-154

    1. Initial program 82.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-identity82.8%

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

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

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

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

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

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

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

    if 1.5000000000000001e-154 < b

    1. Initial program 21.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    7. Applied egg-rr83.8%

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

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

Alternative 4: 80.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 62.9%

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. div-sub62.9%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-\color{blue}{b \cdot \frac{1}{3 \cdot a}}\right) \]
      10. associate-/r*52.0%

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-b \cdot \color{blue}{\frac{\frac{1}{3}}{a}}\right) \]
      11. metadata-eval52.0%

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

      \[\leadsto \color{blue}{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-b \cdot \frac{0.3333333333333333}{a}\right)} \]
    7. Step-by-step derivation
      1. distribute-lft-neg-in52.0%

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \color{blue}{\left(-b\right) \cdot \frac{0.3333333333333333}{a}} \]
      2. distribute-rgt-in52.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{0.3333333333333333 \cdot \left(\mathsf{hypot}\left(b, \sqrt{\left(a \cdot -3\right) \cdot c}\right) - b\right)}}} \]
      3. associate-*l*52.1%

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

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

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

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

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

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

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(-0.6666666666666666 \cdot b\right)} \]
    14. Step-by-step derivation
      1. *-commutative87.2%

        \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(b \cdot -0.6666666666666666\right)} \]
    15. Simplified87.2%

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

    if -1.4e-57 < b < 1.5000000000000001e-154

    1. Initial program 82.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-identity82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.5000000000000001e-154 < b

    1. Initial program 21.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    7. Applied egg-rr83.8%

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

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

Alternative 5: 80.2% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 62.9%

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. div-sub62.9%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-\color{blue}{b \cdot \frac{1}{3 \cdot a}}\right) \]
      10. associate-/r*52.0%

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-b \cdot \color{blue}{\frac{\frac{1}{3}}{a}}\right) \]
      11. metadata-eval52.0%

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

      \[\leadsto \color{blue}{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-b \cdot \frac{0.3333333333333333}{a}\right)} \]
    7. Step-by-step derivation
      1. distribute-lft-neg-in52.0%

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \color{blue}{\left(-b\right) \cdot \frac{0.3333333333333333}{a}} \]
      2. distribute-rgt-in52.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{0.3333333333333333 \cdot \left(\mathsf{hypot}\left(b, \sqrt{\left(a \cdot -3\right) \cdot c}\right) - b\right)}}} \]
      3. associate-*l*52.1%

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

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

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

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

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

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

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(-0.6666666666666666 \cdot b\right)} \]
    14. Step-by-step derivation
      1. *-commutative87.2%

        \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(b \cdot -0.6666666666666666\right)} \]
    15. Simplified87.2%

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

    if -1.0500000000000001e-67 < b < 1.5000000000000001e-154

    1. Initial program 82.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-identity82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.5000000000000001e-154 < b

    1. Initial program 21.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    7. Applied egg-rr83.8%

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

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

Alternative 6: 68.7% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 68.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-identity68.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-\color{blue}{b \cdot \frac{1}{3 \cdot a}}\right) \]
      10. associate-/r*60.3%

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

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

      \[\leadsto \color{blue}{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-b \cdot \frac{0.3333333333333333}{a}\right)} \]
    7. Step-by-step derivation
      1. distribute-lft-neg-in60.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{0.3333333333333333 \cdot \left(\mathsf{hypot}\left(b, \sqrt{\left(a \cdot -3\right) \cdot c}\right) - b\right)}}} \]
      3. associate-*l*60.3%

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

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

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

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

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

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

      \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(-0.6666666666666666 \cdot b\right)} \]
    14. Step-by-step derivation
      1. *-commutative67.2%

        \[\leadsto \frac{1}{a} \cdot \color{blue}{\left(b \cdot -0.6666666666666666\right)} \]
    15. Simplified67.2%

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

    if 1.69999999999999994e-307 < b

    1. Initial program 28.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-identity28.3%

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

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

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

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

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

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

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

Alternative 7: 68.7% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 68.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-identity68.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-\color{blue}{b \cdot \frac{1}{3 \cdot a}}\right) \]
      10. associate-/r*60.3%

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

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

      \[\leadsto \color{blue}{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} + \left(-b \cdot \frac{0.3333333333333333}{a}\right)} \]
    7. Step-by-step derivation
      1. distribute-lft-neg-in60.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{0.3333333333333333 \cdot \left(\mathsf{hypot}\left(b, \sqrt{\left(a \cdot -3\right) \cdot c}\right) - b\right)}}} \]
      3. associate-*l*60.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 28.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-identity28.3%

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

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

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

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

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

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

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

Alternative 8: 68.7% accurate, 11.6× speedup?

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

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


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

    1. Initial program 68.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-identity68.6%

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 28.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-identity28.3%

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

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

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

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

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

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

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

Alternative 9: 68.7% accurate, 11.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;-0.6666666666666666 \cdot \frac{b}{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 68.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-identity68.6%

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 28.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-identity28.3%

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

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

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

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

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

Alternative 10: 35.8% 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 46.1%

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

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

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

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

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
  6. Add Preprocessing

Reproduce

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