Cubic critical

Percentage Accurate: 51.9% → 84.3%
Time: 15.8s
Alternatives: 8
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 8 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.9% 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.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{if}\;b \leq -2.1 \cdot 10^{+128}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(b, 2, \frac{a \cdot -1.5}{b} \cdot c\right)}{a}}{-3}\\ \mathbf{elif}\;b \leq 9.8 \cdot 10^{-88}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 5.8 \cdot 10^{-71}:\\ \;\;\;\;-0.375 \cdot \left(\frac{a}{{b}^{3}} \cdot {c}^{2}\right) + \frac{c}{\frac{b}{-0.5}}\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{+27}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))))
   (if (<= b -2.1e+128)
     (/ (/ (fma b 2.0 (* (/ (* a -1.5) b) c)) a) -3.0)
     (if (<= b 9.8e-88)
       t_0
       (if (<= b 5.8e-71)
         (+ (* -0.375 (* (/ a (pow b 3.0)) (pow c 2.0))) (/ c (/ b -0.5)))
         (if (<= b 6.5e+27) t_0 (/ (* c -0.5) b)))))))
double code(double a, double b, double c) {
	double t_0 = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	double tmp;
	if (b <= -2.1e+128) {
		tmp = (fma(b, 2.0, (((a * -1.5) / b) * c)) / a) / -3.0;
	} else if (b <= 9.8e-88) {
		tmp = t_0;
	} else if (b <= 5.8e-71) {
		tmp = (-0.375 * ((a / pow(b, 3.0)) * pow(c, 2.0))) + (c / (b / -0.5));
	} else if (b <= 6.5e+27) {
		tmp = t_0;
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0))
	tmp = 0.0
	if (b <= -2.1e+128)
		tmp = Float64(Float64(fma(b, 2.0, Float64(Float64(Float64(a * -1.5) / b) * c)) / a) / -3.0);
	elseif (b <= 9.8e-88)
		tmp = t_0;
	elseif (b <= 5.8e-71)
		tmp = Float64(Float64(-0.375 * Float64(Float64(a / (b ^ 3.0)) * (c ^ 2.0))) + Float64(c / Float64(b / -0.5)));
	elseif (b <= 6.5e+27)
		tmp = t_0;
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2.1e+128], N[(N[(N[(b * 2.0 + N[(N[(N[(a * -1.5), $MachinePrecision] / b), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], If[LessEqual[b, 9.8e-88], t$95$0, If[LessEqual[b, 5.8e-71], N[(N[(-0.375 * N[(N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c / N[(b / -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.5e+27], t$95$0, N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{if}\;b \leq -2.1 \cdot 10^{+128}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(b, 2, \frac{a \cdot -1.5}{b} \cdot c\right)}{a}}{-3}\\

\mathbf{elif}\;b \leq 9.8 \cdot 10^{-88}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;b \leq 5.8 \cdot 10^{-71}:\\
\;\;\;\;-0.375 \cdot \left(\frac{a}{{b}^{3}} \cdot {c}^{2}\right) + \frac{c}{\frac{b}{-0.5}}\\

\mathbf{elif}\;b \leq 6.5 \cdot 10^{+27}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -2.1e128

    1. Initial program 44.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot \frac{1}{a}}{-3}} \]
    8. Step-by-step derivation
      1. un-div-inv60.8%

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

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

      \[\leadsto \frac{\color{blue}{\frac{b}{a} - \frac{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a}}}{-3} \]
    10. Step-by-step derivation
      1. div-sub60.8%

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

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

      \[\leadsto \frac{\frac{\color{blue}{0.5 \cdot \frac{a \cdot \left(c \cdot {\left(\sqrt{-3}\right)}^{2}\right)}{b} + 2 \cdot b}}{a}}{-3} \]
    13. Step-by-step derivation
      1. +-commutative0.0%

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\color{blue}{\left(0.5 \cdot \left(c \cdot {\left(\sqrt{-3}\right)}^{2}\right)\right) \cdot a}}{b}\right)}{a}}{-3} \]
      7. *-commutative0.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\left(0.5 \cdot \color{blue}{\left({\left(\sqrt{-3}\right)}^{2} \cdot c\right)}\right) \cdot a}{b}\right)}{a}}{-3} \]
      8. unpow20.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\left(0.5 \cdot \left(\color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)} \cdot c\right)\right) \cdot a}{b}\right)}{a}}{-3} \]
      9. rem-square-sqrt96.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\left(0.5 \cdot \left(\color{blue}{-3} \cdot c\right)\right) \cdot a}{b}\right)}{a}}{-3} \]
      10. associate-*r*96.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\color{blue}{\left(\left(0.5 \cdot -3\right) \cdot c\right)} \cdot a}{b}\right)}{a}}{-3} \]
      11. metadata-eval96.0%

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

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

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

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

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

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

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

    if -2.1e128 < b < 9.80000000000000055e-88 or 5.7999999999999997e-71 < b < 6.5000000000000005e27

    1. Initial program 86.6%

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

    if 9.80000000000000055e-88 < b < 5.7999999999999997e-71

    1. Initial program 7.9%

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
    4. Step-by-step derivation
      1. +-commutative98.8%

        \[\leadsto \color{blue}{-0.375 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + -0.5 \cdot \frac{c}{b}} \]
      2. fma-def98.8%

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

        \[\leadsto \mathsf{fma}\left(-0.375, \color{blue}{\frac{a}{\frac{{b}^{3}}{{c}^{2}}}}, -0.5 \cdot \frac{c}{b}\right) \]
      4. *-commutative80.1%

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

        \[\leadsto \mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{{c}^{2}}}, \color{blue}{\frac{c \cdot -0.5}{b}}\right) \]
    5. Simplified80.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375, \frac{a}{\frac{{b}^{3}}{{c}^{2}}}, \frac{c \cdot -0.5}{b}\right)} \]
    6. Step-by-step derivation
      1. fma-udef80.1%

        \[\leadsto \color{blue}{-0.375 \cdot \frac{a}{\frac{{b}^{3}}{{c}^{2}}} + \frac{c \cdot -0.5}{b}} \]
      2. associate-/r/100.0%

        \[\leadsto -0.375 \cdot \color{blue}{\left(\frac{a}{{b}^{3}} \cdot {c}^{2}\right)} + \frac{c \cdot -0.5}{b} \]
      3. associate-/l*100.0%

        \[\leadsto -0.375 \cdot \left(\frac{a}{{b}^{3}} \cdot {c}^{2}\right) + \color{blue}{\frac{c}{\frac{b}{-0.5}}} \]
    7. Applied egg-rr100.0%

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

    if 6.5000000000000005e27 < b

    1. Initial program 11.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.1 \cdot 10^{+128}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(b, 2, \frac{a \cdot -1.5}{b} \cdot c\right)}{a}}{-3}\\ \mathbf{elif}\;b \leq 9.8 \cdot 10^{-88}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 5.8 \cdot 10^{-71}:\\ \;\;\;\;-0.375 \cdot \left(\frac{a}{{b}^{3}} \cdot {c}^{2}\right) + \frac{c}{\frac{b}{-0.5}}\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{+27}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 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 2: 84.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\ \mathbf{if}\;b \leq -2.2 \cdot 10^{+128}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(b, 2, \frac{a \cdot -1.5}{b} \cdot c\right)}{a}}{-3}\\ \mathbf{elif}\;b \leq 7.5 \cdot 10^{-89}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 2.2 \cdot 10^{-66}:\\ \;\;\;\;c \cdot \frac{-0.5}{b}\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{+27}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (- (sqrt (- (* b b) (* 3.0 (* a c)))) b) (* a 3.0))))
   (if (<= b -2.2e+128)
     (/ (/ (fma b 2.0 (* (/ (* a -1.5) b) c)) a) -3.0)
     (if (<= b 7.5e-89)
       t_0
       (if (<= b 2.2e-66)
         (* c (/ -0.5 b))
         (if (<= b 6.5e+27) t_0 (/ (* c -0.5) b)))))))
double code(double a, double b, double c) {
	double t_0 = (sqrt(((b * b) - (3.0 * (a * c)))) - b) / (a * 3.0);
	double tmp;
	if (b <= -2.2e+128) {
		tmp = (fma(b, 2.0, (((a * -1.5) / b) * c)) / a) / -3.0;
	} else if (b <= 7.5e-89) {
		tmp = t_0;
	} else if (b <= 2.2e-66) {
		tmp = c * (-0.5 / b);
	} else if (b <= 6.5e+27) {
		tmp = t_0;
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(3.0 * Float64(a * c)))) - b) / Float64(a * 3.0))
	tmp = 0.0
	if (b <= -2.2e+128)
		tmp = Float64(Float64(fma(b, 2.0, Float64(Float64(Float64(a * -1.5) / b) * c)) / a) / -3.0);
	elseif (b <= 7.5e-89)
		tmp = t_0;
	elseif (b <= 2.2e-66)
		tmp = Float64(c * Float64(-0.5 / b));
	elseif (b <= 6.5e+27)
		tmp = t_0;
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2.2e+128], N[(N[(N[(b * 2.0 + N[(N[(N[(a * -1.5), $MachinePrecision] / b), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], If[LessEqual[b, 7.5e-89], t$95$0, If[LessEqual[b, 2.2e-66], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.5e+27], t$95$0, N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\
\mathbf{if}\;b \leq -2.2 \cdot 10^{+128}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(b, 2, \frac{a \cdot -1.5}{b} \cdot c\right)}{a}}{-3}\\

\mathbf{elif}\;b \leq 7.5 \cdot 10^{-89}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;b \leq 2.2 \cdot 10^{-66}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\

\mathbf{elif}\;b \leq 6.5 \cdot 10^{+27}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -2.20000000000000017e128

    1. Initial program 44.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot \frac{1}{a}}{-3}} \]
    8. Step-by-step derivation
      1. un-div-inv60.8%

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

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

      \[\leadsto \frac{\color{blue}{\frac{b}{a} - \frac{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a}}}{-3} \]
    10. Step-by-step derivation
      1. div-sub60.8%

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

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

      \[\leadsto \frac{\frac{\color{blue}{0.5 \cdot \frac{a \cdot \left(c \cdot {\left(\sqrt{-3}\right)}^{2}\right)}{b} + 2 \cdot b}}{a}}{-3} \]
    13. Step-by-step derivation
      1. +-commutative0.0%

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\color{blue}{\left(0.5 \cdot \left(c \cdot {\left(\sqrt{-3}\right)}^{2}\right)\right) \cdot a}}{b}\right)}{a}}{-3} \]
      7. *-commutative0.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\left(0.5 \cdot \color{blue}{\left({\left(\sqrt{-3}\right)}^{2} \cdot c\right)}\right) \cdot a}{b}\right)}{a}}{-3} \]
      8. unpow20.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\left(0.5 \cdot \left(\color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)} \cdot c\right)\right) \cdot a}{b}\right)}{a}}{-3} \]
      9. rem-square-sqrt96.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\left(0.5 \cdot \left(\color{blue}{-3} \cdot c\right)\right) \cdot a}{b}\right)}{a}}{-3} \]
      10. associate-*r*96.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\color{blue}{\left(\left(0.5 \cdot -3\right) \cdot c\right)} \cdot a}{b}\right)}{a}}{-3} \]
      11. metadata-eval96.0%

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

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

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

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

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

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

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

    if -2.20000000000000017e128 < b < 7.4999999999999999e-89 or 2.2000000000000001e-66 < b < 6.5000000000000005e27

    1. Initial program 86.6%

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

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

    if 7.4999999999999999e-89 < b < 2.2000000000000001e-66

    1. Initial program 7.9%

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

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

        \[\leadsto \frac{-1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}}{3 \cdot a} \]
    5. Simplified97.6%

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-1.5 \cdot \frac{a}{\frac{b}{c}}}{3 \cdot a}\right)} - 1} \]
      3. times-frac19.7%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-1.5}{3} \cdot \frac{\frac{a}{\frac{b}{c}}}{a}}\right)} - 1 \]
      4. metadata-eval19.7%

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\frac{\frac{a}{b}}{\frac{a}{c}}} \]
    9. Simplified79.5%

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \frac{a}{b}}{\frac{a}{c}}} \]
      2. clear-num79.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{a}{c}}{-0.5 \cdot \frac{a}{b}}}} \]
    11. Applied egg-rr79.8%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{\frac{a}{c}} \cdot \frac{a}{b}\right) \cdot -0.5} \]
      4. times-frac79.5%

        \[\leadsto \color{blue}{\frac{1 \cdot a}{\frac{a}{c} \cdot b}} \cdot -0.5 \]
      5. *-commutative79.5%

        \[\leadsto \frac{\color{blue}{a \cdot 1}}{\frac{a}{c} \cdot b} \cdot -0.5 \]
      6. *-rgt-identity79.5%

        \[\leadsto \frac{\color{blue}{a}}{\frac{a}{c} \cdot b} \cdot -0.5 \]
      7. *-commutative79.5%

        \[\leadsto \frac{a}{\color{blue}{b \cdot \frac{a}{c}}} \cdot -0.5 \]
    13. Simplified79.5%

      \[\leadsto \color{blue}{\frac{a}{b \cdot \frac{a}{c}} \cdot -0.5} \]
    14. Step-by-step derivation
      1. *-commutative79.5%

        \[\leadsto \color{blue}{-0.5 \cdot \frac{a}{b \cdot \frac{a}{c}}} \]
      2. clear-num79.5%

        \[\leadsto -0.5 \cdot \color{blue}{\frac{1}{\frac{b \cdot \frac{a}{c}}{a}}} \]
      3. un-div-inv79.5%

        \[\leadsto \color{blue}{\frac{-0.5}{\frac{b \cdot \frac{a}{c}}{a}}} \]
    15. Applied egg-rr79.5%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot a}{b \cdot \frac{a}{c}}} \]
      3. *-commutative79.5%

        \[\leadsto \frac{\color{blue}{a \cdot -0.5}}{b \cdot \frac{a}{c}} \]
      4. *-commutative79.5%

        \[\leadsto \frac{a \cdot -0.5}{\color{blue}{\frac{a}{c} \cdot b}} \]
      5. times-frac79.8%

        \[\leadsto \color{blue}{\frac{a}{\frac{a}{c}} \cdot \frac{-0.5}{b}} \]
      6. associate-/r/98.8%

        \[\leadsto \color{blue}{\left(\frac{a}{a} \cdot c\right)} \cdot \frac{-0.5}{b} \]
      7. *-inverses98.8%

        \[\leadsto \left(\color{blue}{1} \cdot c\right) \cdot \frac{-0.5}{b} \]
      8. *-lft-identity98.8%

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

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

    if 6.5000000000000005e27 < b

    1. Initial program 11.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.2 \cdot 10^{+128}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(b, 2, \frac{a \cdot -1.5}{b} \cdot c\right)}{a}}{-3}\\ \mathbf{elif}\;b \leq 7.5 \cdot 10^{-89}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 2.2 \cdot 10^{-66}:\\ \;\;\;\;c \cdot \frac{-0.5}{b}\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{+27}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 84.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{if}\;b \leq -2 \cdot 10^{+127}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(b, 2, \frac{a \cdot -1.5}{b} \cdot c\right)}{a}}{-3}\\ \mathbf{elif}\;b \leq 2.1 \cdot 10^{-87}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 2.65 \cdot 10^{-64}:\\ \;\;\;\;c \cdot \frac{-0.5}{b}\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{+27}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (- (sqrt (- (* b b) (* a (* c 3.0)))) b) (* a 3.0))))
   (if (<= b -2e+127)
     (/ (/ (fma b 2.0 (* (/ (* a -1.5) b) c)) a) -3.0)
     (if (<= b 2.1e-87)
       t_0
       (if (<= b 2.65e-64)
         (* c (/ -0.5 b))
         (if (<= b 6.5e+27) t_0 (/ (* c -0.5) b)))))))
double code(double a, double b, double c) {
	double t_0 = (sqrt(((b * b) - (a * (c * 3.0)))) - b) / (a * 3.0);
	double tmp;
	if (b <= -2e+127) {
		tmp = (fma(b, 2.0, (((a * -1.5) / b) * c)) / a) / -3.0;
	} else if (b <= 2.1e-87) {
		tmp = t_0;
	} else if (b <= 2.65e-64) {
		tmp = c * (-0.5 / b);
	} else if (b <= 6.5e+27) {
		tmp = t_0;
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(a * Float64(c * 3.0)))) - b) / Float64(a * 3.0))
	tmp = 0.0
	if (b <= -2e+127)
		tmp = Float64(Float64(fma(b, 2.0, Float64(Float64(Float64(a * -1.5) / b) * c)) / a) / -3.0);
	elseif (b <= 2.1e-87)
		tmp = t_0;
	elseif (b <= 2.65e-64)
		tmp = Float64(c * Float64(-0.5 / b));
	elseif (b <= 6.5e+27)
		tmp = t_0;
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(a * N[(c * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2e+127], N[(N[(N[(b * 2.0 + N[(N[(N[(a * -1.5), $MachinePrecision] / b), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], If[LessEqual[b, 2.1e-87], t$95$0, If[LessEqual[b, 2.65e-64], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.5e+27], t$95$0, N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{if}\;b \leq -2 \cdot 10^{+127}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(b, 2, \frac{a \cdot -1.5}{b} \cdot c\right)}{a}}{-3}\\

\mathbf{elif}\;b \leq 2.1 \cdot 10^{-87}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;b \leq 2.65 \cdot 10^{-64}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\

\mathbf{elif}\;b \leq 6.5 \cdot 10^{+27}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -1.99999999999999991e127

    1. Initial program 44.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot \frac{1}{a}}{-3}} \]
    8. Step-by-step derivation
      1. un-div-inv60.8%

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

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

      \[\leadsto \frac{\color{blue}{\frac{b}{a} - \frac{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a}}}{-3} \]
    10. Step-by-step derivation
      1. div-sub60.8%

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

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

      \[\leadsto \frac{\frac{\color{blue}{0.5 \cdot \frac{a \cdot \left(c \cdot {\left(\sqrt{-3}\right)}^{2}\right)}{b} + 2 \cdot b}}{a}}{-3} \]
    13. Step-by-step derivation
      1. +-commutative0.0%

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\color{blue}{\left(0.5 \cdot \left(c \cdot {\left(\sqrt{-3}\right)}^{2}\right)\right) \cdot a}}{b}\right)}{a}}{-3} \]
      7. *-commutative0.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\left(0.5 \cdot \color{blue}{\left({\left(\sqrt{-3}\right)}^{2} \cdot c\right)}\right) \cdot a}{b}\right)}{a}}{-3} \]
      8. unpow20.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\left(0.5 \cdot \left(\color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)} \cdot c\right)\right) \cdot a}{b}\right)}{a}}{-3} \]
      9. rem-square-sqrt96.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\left(0.5 \cdot \left(\color{blue}{-3} \cdot c\right)\right) \cdot a}{b}\right)}{a}}{-3} \]
      10. associate-*r*96.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\color{blue}{\left(\left(0.5 \cdot -3\right) \cdot c\right)} \cdot a}{b}\right)}{a}}{-3} \]
      11. metadata-eval96.0%

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

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

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

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

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

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

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

    if -1.99999999999999991e127 < b < 2.10000000000000007e-87 or 2.6500000000000001e-64 < b < 6.5000000000000005e27

    1. Initial program 86.6%

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

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

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

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

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

    if 2.10000000000000007e-87 < b < 2.6500000000000001e-64

    1. Initial program 7.9%

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

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

        \[\leadsto \frac{-1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}}{3 \cdot a} \]
    5. Simplified97.6%

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-1.5 \cdot \frac{a}{\frac{b}{c}}}{3 \cdot a}\right)} - 1} \]
      3. times-frac19.7%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-1.5}{3} \cdot \frac{\frac{a}{\frac{b}{c}}}{a}}\right)} - 1 \]
      4. metadata-eval19.7%

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\frac{\frac{a}{b}}{\frac{a}{c}}} \]
    9. Simplified79.5%

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \frac{a}{b}}{\frac{a}{c}}} \]
      2. clear-num79.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{a}{c}}{-0.5 \cdot \frac{a}{b}}}} \]
    11. Applied egg-rr79.8%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{\frac{a}{c}} \cdot \frac{a}{b}\right) \cdot -0.5} \]
      4. times-frac79.5%

        \[\leadsto \color{blue}{\frac{1 \cdot a}{\frac{a}{c} \cdot b}} \cdot -0.5 \]
      5. *-commutative79.5%

        \[\leadsto \frac{\color{blue}{a \cdot 1}}{\frac{a}{c} \cdot b} \cdot -0.5 \]
      6. *-rgt-identity79.5%

        \[\leadsto \frac{\color{blue}{a}}{\frac{a}{c} \cdot b} \cdot -0.5 \]
      7. *-commutative79.5%

        \[\leadsto \frac{a}{\color{blue}{b \cdot \frac{a}{c}}} \cdot -0.5 \]
    13. Simplified79.5%

      \[\leadsto \color{blue}{\frac{a}{b \cdot \frac{a}{c}} \cdot -0.5} \]
    14. Step-by-step derivation
      1. *-commutative79.5%

        \[\leadsto \color{blue}{-0.5 \cdot \frac{a}{b \cdot \frac{a}{c}}} \]
      2. clear-num79.5%

        \[\leadsto -0.5 \cdot \color{blue}{\frac{1}{\frac{b \cdot \frac{a}{c}}{a}}} \]
      3. un-div-inv79.5%

        \[\leadsto \color{blue}{\frac{-0.5}{\frac{b \cdot \frac{a}{c}}{a}}} \]
    15. Applied egg-rr79.5%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot a}{b \cdot \frac{a}{c}}} \]
      3. *-commutative79.5%

        \[\leadsto \frac{\color{blue}{a \cdot -0.5}}{b \cdot \frac{a}{c}} \]
      4. *-commutative79.5%

        \[\leadsto \frac{a \cdot -0.5}{\color{blue}{\frac{a}{c} \cdot b}} \]
      5. times-frac79.8%

        \[\leadsto \color{blue}{\frac{a}{\frac{a}{c}} \cdot \frac{-0.5}{b}} \]
      6. associate-/r/98.8%

        \[\leadsto \color{blue}{\left(\frac{a}{a} \cdot c\right)} \cdot \frac{-0.5}{b} \]
      7. *-inverses98.8%

        \[\leadsto \left(\color{blue}{1} \cdot c\right) \cdot \frac{-0.5}{b} \]
      8. *-lft-identity98.8%

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

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

    if 6.5000000000000005e27 < b

    1. Initial program 11.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{+127}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(b, 2, \frac{a \cdot -1.5}{b} \cdot c\right)}{a}}{-3}\\ \mathbf{elif}\;b \leq 2.1 \cdot 10^{-87}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 2.65 \cdot 10^{-64}:\\ \;\;\;\;c \cdot \frac{-0.5}{b}\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{+27}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 84.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{if}\;b \leq -1.6 \cdot 10^{+127}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(b, 2, \frac{a \cdot -1.5}{b} \cdot c\right)}{a}}{-3}\\ \mathbf{elif}\;b \leq 5.6 \cdot 10^{-89}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{-66}:\\ \;\;\;\;c \cdot \frac{-0.5}{b}\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{+32}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))))
   (if (<= b -1.6e+127)
     (/ (/ (fma b 2.0 (* (/ (* a -1.5) b) c)) a) -3.0)
     (if (<= b 5.6e-89)
       t_0
       (if (<= b 8.5e-66)
         (* c (/ -0.5 b))
         (if (<= b 4.4e+32) t_0 (/ (* c -0.5) b)))))))
double code(double a, double b, double c) {
	double t_0 = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	double tmp;
	if (b <= -1.6e+127) {
		tmp = (fma(b, 2.0, (((a * -1.5) / b) * c)) / a) / -3.0;
	} else if (b <= 5.6e-89) {
		tmp = t_0;
	} else if (b <= 8.5e-66) {
		tmp = c * (-0.5 / b);
	} else if (b <= 4.4e+32) {
		tmp = t_0;
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0))
	tmp = 0.0
	if (b <= -1.6e+127)
		tmp = Float64(Float64(fma(b, 2.0, Float64(Float64(Float64(a * -1.5) / b) * c)) / a) / -3.0);
	elseif (b <= 5.6e-89)
		tmp = t_0;
	elseif (b <= 8.5e-66)
		tmp = Float64(c * Float64(-0.5 / b));
	elseif (b <= 4.4e+32)
		tmp = t_0;
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.6e+127], N[(N[(N[(b * 2.0 + N[(N[(N[(a * -1.5), $MachinePrecision] / b), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] / -3.0), $MachinePrecision], If[LessEqual[b, 5.6e-89], t$95$0, If[LessEqual[b, 8.5e-66], N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.4e+32], t$95$0, N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{if}\;b \leq -1.6 \cdot 10^{+127}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(b, 2, \frac{a \cdot -1.5}{b} \cdot c\right)}{a}}{-3}\\

\mathbf{elif}\;b \leq 5.6 \cdot 10^{-89}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;b \leq 8.5 \cdot 10^{-66}:\\
\;\;\;\;c \cdot \frac{-0.5}{b}\\

\mathbf{elif}\;b \leq 4.4 \cdot 10^{+32}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -1.59999999999999988e127

    1. Initial program 44.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)\right) \cdot \frac{1}{a}}{-3}} \]
    8. Step-by-step derivation
      1. un-div-inv60.8%

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

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

      \[\leadsto \frac{\color{blue}{\frac{b}{a} - \frac{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a}}}{-3} \]
    10. Step-by-step derivation
      1. div-sub60.8%

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

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

      \[\leadsto \frac{\frac{\color{blue}{0.5 \cdot \frac{a \cdot \left(c \cdot {\left(\sqrt{-3}\right)}^{2}\right)}{b} + 2 \cdot b}}{a}}{-3} \]
    13. Step-by-step derivation
      1. +-commutative0.0%

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\color{blue}{\left(0.5 \cdot \left(c \cdot {\left(\sqrt{-3}\right)}^{2}\right)\right) \cdot a}}{b}\right)}{a}}{-3} \]
      7. *-commutative0.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\left(0.5 \cdot \color{blue}{\left({\left(\sqrt{-3}\right)}^{2} \cdot c\right)}\right) \cdot a}{b}\right)}{a}}{-3} \]
      8. unpow20.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\left(0.5 \cdot \left(\color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)} \cdot c\right)\right) \cdot a}{b}\right)}{a}}{-3} \]
      9. rem-square-sqrt96.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\left(0.5 \cdot \left(\color{blue}{-3} \cdot c\right)\right) \cdot a}{b}\right)}{a}}{-3} \]
      10. associate-*r*96.0%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(b, 2, \frac{\color{blue}{\left(\left(0.5 \cdot -3\right) \cdot c\right)} \cdot a}{b}\right)}{a}}{-3} \]
      11. metadata-eval96.0%

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

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

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

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

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

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

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

    if -1.59999999999999988e127 < b < 5.5999999999999998e-89 or 8.49999999999999966e-66 < b < 4.40000000000000002e32

    1. Initial program 86.6%

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

    if 5.5999999999999998e-89 < b < 8.49999999999999966e-66

    1. Initial program 7.9%

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

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

        \[\leadsto \frac{-1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}}{3 \cdot a} \]
    5. Simplified97.6%

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-1.5 \cdot \frac{a}{\frac{b}{c}}}{3 \cdot a}\right)} - 1} \]
      3. times-frac19.7%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-1.5}{3} \cdot \frac{\frac{a}{\frac{b}{c}}}{a}}\right)} - 1 \]
      4. metadata-eval19.7%

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\frac{\frac{a}{b}}{\frac{a}{c}}} \]
    9. Simplified79.5%

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \frac{a}{b}}{\frac{a}{c}}} \]
      2. clear-num79.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{a}{c}}{-0.5 \cdot \frac{a}{b}}}} \]
    11. Applied egg-rr79.8%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{\frac{a}{c}} \cdot \frac{a}{b}\right) \cdot -0.5} \]
      4. times-frac79.5%

        \[\leadsto \color{blue}{\frac{1 \cdot a}{\frac{a}{c} \cdot b}} \cdot -0.5 \]
      5. *-commutative79.5%

        \[\leadsto \frac{\color{blue}{a \cdot 1}}{\frac{a}{c} \cdot b} \cdot -0.5 \]
      6. *-rgt-identity79.5%

        \[\leadsto \frac{\color{blue}{a}}{\frac{a}{c} \cdot b} \cdot -0.5 \]
      7. *-commutative79.5%

        \[\leadsto \frac{a}{\color{blue}{b \cdot \frac{a}{c}}} \cdot -0.5 \]
    13. Simplified79.5%

      \[\leadsto \color{blue}{\frac{a}{b \cdot \frac{a}{c}} \cdot -0.5} \]
    14. Step-by-step derivation
      1. *-commutative79.5%

        \[\leadsto \color{blue}{-0.5 \cdot \frac{a}{b \cdot \frac{a}{c}}} \]
      2. clear-num79.5%

        \[\leadsto -0.5 \cdot \color{blue}{\frac{1}{\frac{b \cdot \frac{a}{c}}{a}}} \]
      3. un-div-inv79.5%

        \[\leadsto \color{blue}{\frac{-0.5}{\frac{b \cdot \frac{a}{c}}{a}}} \]
    15. Applied egg-rr79.5%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot a}{b \cdot \frac{a}{c}}} \]
      3. *-commutative79.5%

        \[\leadsto \frac{\color{blue}{a \cdot -0.5}}{b \cdot \frac{a}{c}} \]
      4. *-commutative79.5%

        \[\leadsto \frac{a \cdot -0.5}{\color{blue}{\frac{a}{c} \cdot b}} \]
      5. times-frac79.8%

        \[\leadsto \color{blue}{\frac{a}{\frac{a}{c}} \cdot \frac{-0.5}{b}} \]
      6. associate-/r/98.8%

        \[\leadsto \color{blue}{\left(\frac{a}{a} \cdot c\right)} \cdot \frac{-0.5}{b} \]
      7. *-inverses98.8%

        \[\leadsto \left(\color{blue}{1} \cdot c\right) \cdot \frac{-0.5}{b} \]
      8. *-lft-identity98.8%

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

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

    if 4.40000000000000002e32 < b

    1. Initial program 11.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.6 \cdot 10^{+127}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(b, 2, \frac{a \cdot -1.5}{b} \cdot c\right)}{a}}{-3}\\ \mathbf{elif}\;b \leq 5.6 \cdot 10^{-89}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{-66}:\\ \;\;\;\;c \cdot \frac{-0.5}{b}\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{+32}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 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 5: 68.5% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 74.5%

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

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

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

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

    if -3.999999999999988e-310 < b

    1. Initial program 40.4%

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

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

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

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

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

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

Alternative 6: 68.4% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 74.5%

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

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

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

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

    if -3.999999999999988e-310 < b

    1. Initial program 40.4%

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

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

        \[\leadsto \frac{-1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}}{3 \cdot a} \]
    5. Simplified52.2%

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-1.5 \cdot \frac{a}{\frac{b}{c}}}{3 \cdot a}\right)} - 1} \]
      3. times-frac22.6%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-1.5}{3} \cdot \frac{\frac{a}{\frac{b}{c}}}{a}}\right)} - 1 \]
      4. metadata-eval22.6%

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\frac{\frac{a}{b}}{\frac{a}{c}}} \]
    9. Simplified50.8%

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \frac{a}{b}}{\frac{a}{c}}} \]
      2. clear-num50.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{a}{c}}{-0.5 \cdot \frac{a}{b}}}} \]
    11. Applied egg-rr50.5%

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{\frac{a}{c}} \cdot \frac{a}{b}\right) \cdot -0.5} \]
      4. times-frac52.6%

        \[\leadsto \color{blue}{\frac{1 \cdot a}{\frac{a}{c} \cdot b}} \cdot -0.5 \]
      5. *-commutative52.6%

        \[\leadsto \frac{\color{blue}{a \cdot 1}}{\frac{a}{c} \cdot b} \cdot -0.5 \]
      6. *-rgt-identity52.6%

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

        \[\leadsto \frac{a}{\color{blue}{b \cdot \frac{a}{c}}} \cdot -0.5 \]
    13. Simplified52.6%

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

        \[\leadsto \color{blue}{-0.5 \cdot \frac{a}{b \cdot \frac{a}{c}}} \]
      2. clear-num52.3%

        \[\leadsto -0.5 \cdot \color{blue}{\frac{1}{\frac{b \cdot \frac{a}{c}}{a}}} \]
      3. un-div-inv52.3%

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot a}{b \cdot \frac{a}{c}}} \]
      3. *-commutative52.6%

        \[\leadsto \frac{\color{blue}{a \cdot -0.5}}{b \cdot \frac{a}{c}} \]
      4. *-commutative52.6%

        \[\leadsto \frac{a \cdot -0.5}{\color{blue}{\frac{a}{c} \cdot b}} \]
      5. times-frac57.1%

        \[\leadsto \color{blue}{\frac{a}{\frac{a}{c}} \cdot \frac{-0.5}{b}} \]
      6. associate-/r/62.4%

        \[\leadsto \color{blue}{\left(\frac{a}{a} \cdot c\right)} \cdot \frac{-0.5}{b} \]
      7. *-inverses62.4%

        \[\leadsto \left(\color{blue}{1} \cdot c\right) \cdot \frac{-0.5}{b} \]
      8. *-lft-identity62.4%

        \[\leadsto \color{blue}{c} \cdot \frac{-0.5}{b} \]
    17. Simplified62.4%

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

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

Alternative 7: 68.5% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 74.5%

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

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

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

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

    if 4.5000000000000011e-309 < b

    1. Initial program 40.4%

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

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

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

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

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

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

Alternative 8: 34.8% accurate, 23.2× speedup?

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

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

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

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

      \[\leadsto \frac{-1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}}{3 \cdot a} \]
  5. Simplified26.5%

    \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a}{\frac{b}{c}}}}{3 \cdot a} \]
  6. Step-by-step derivation
    1. expm1-log1p-u24.0%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{-1.5 \cdot \frac{a}{\frac{b}{c}}}{3 \cdot a}\right)} - 1} \]
    3. times-frac11.9%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-1.5}{3} \cdot \frac{\frac{a}{\frac{b}{c}}}{a}}\right)} - 1 \]
    4. metadata-eval11.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-0.5 \cdot \frac{a}{b}}{\frac{a}{c}}} \]
    2. clear-num26.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{a}{c}}{-0.5 \cdot \frac{a}{b}}}} \]
  11. Applied egg-rr26.0%

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{\frac{a}{c}} \cdot \frac{a}{b}\right) \cdot -0.5} \]
    4. times-frac28.6%

      \[\leadsto \color{blue}{\frac{1 \cdot a}{\frac{a}{c} \cdot b}} \cdot -0.5 \]
    5. *-commutative28.6%

      \[\leadsto \frac{\color{blue}{a \cdot 1}}{\frac{a}{c} \cdot b} \cdot -0.5 \]
    6. *-rgt-identity28.6%

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

      \[\leadsto \frac{a}{\color{blue}{b \cdot \frac{a}{c}}} \cdot -0.5 \]
  13. Simplified28.6%

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{a}{b \cdot \frac{a}{c}}} \]
    2. clear-num28.5%

      \[\leadsto -0.5 \cdot \color{blue}{\frac{1}{\frac{b \cdot \frac{a}{c}}{a}}} \]
    3. un-div-inv28.5%

      \[\leadsto \color{blue}{\frac{-0.5}{\frac{b \cdot \frac{a}{c}}{a}}} \]
  15. Applied egg-rr28.5%

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

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

      \[\leadsto \color{blue}{\frac{-0.5 \cdot a}{b \cdot \frac{a}{c}}} \]
    3. *-commutative28.6%

      \[\leadsto \frac{\color{blue}{a \cdot -0.5}}{b \cdot \frac{a}{c}} \]
    4. *-commutative28.6%

      \[\leadsto \frac{a \cdot -0.5}{\color{blue}{\frac{a}{c} \cdot b}} \]
    5. times-frac30.8%

      \[\leadsto \color{blue}{\frac{a}{\frac{a}{c}} \cdot \frac{-0.5}{b}} \]
    6. associate-/r/31.5%

      \[\leadsto \color{blue}{\left(\frac{a}{a} \cdot c\right)} \cdot \frac{-0.5}{b} \]
    7. *-inverses31.5%

      \[\leadsto \left(\color{blue}{1} \cdot c\right) \cdot \frac{-0.5}{b} \]
    8. *-lft-identity31.5%

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

    \[\leadsto \color{blue}{c \cdot \frac{-0.5}{b}} \]
  18. Final simplification31.5%

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

Reproduce

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