Cubic critical

Percentage Accurate: 52.8% → 86.0%
Time: 18.7s
Alternatives: 14
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 14 alternatives:

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

Initial Program: 52.8% 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: 86.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.8 \cdot 10^{+139}:\\
\;\;\;\;\frac{\frac{b}{-1.5}}{a}\\

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

\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{fma}\left(-0.5, \frac{a}{b}, 0.6666666666666666 \cdot \frac{b}{c}\right)\right)}^{-1} \cdot -0.3333333333333333\\


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

    1. Initial program 41.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 94.5%

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(\left(\frac{b}{a} \cdot -0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot -0.6666666666666666\right)\right) \cdot \left(\frac{b}{a} \cdot -0.6666666666666666\right)\right)}^{0.3333333333333333}} \]
      3. pow334.3%

        \[\leadsto {\color{blue}{\left({\left(\frac{b}{a} \cdot -0.6666666666666666\right)}^{3}\right)}}^{0.3333333333333333} \]
    7. Applied egg-rr34.3%

      \[\leadsto \color{blue}{{\left({\left(\frac{b}{a} \cdot -0.6666666666666666\right)}^{3}\right)}^{0.3333333333333333}} \]
    8. Step-by-step derivation
      1. unpow1/360.9%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{b}{a} \cdot -0.6666666666666666\right)}^{3}}} \]
      2. rem-cbrt-cube94.5%

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      3. metadata-eval94.5%

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

        \[\leadsto \color{blue}{\frac{b \cdot -2}{a \cdot 3}} \]
      5. associate-/l/94.7%

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

        \[\leadsto \frac{\color{blue}{\frac{b}{\frac{3}{-2}}}}{a} \]
      7. metadata-eval94.7%

        \[\leadsto \frac{\frac{b}{\color{blue}{-1.5}}}{a} \]
    9. Applied egg-rr94.7%

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

    if -2.7999999999999998e139 < b < 1.0999999999999999e-50

    1. Initial program 80.7%

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

    if 1.0999999999999999e-50 < b

    1. Initial program 16.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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}} \]
    7. Step-by-step derivation
      1. associate-*r/16.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(-0.5, \frac{a}{b}, \frac{-2 \cdot b}{\color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)} \cdot c}\right)\right)}^{-1} \cdot -0.3333333333333333 \]
      6. rem-square-sqrt82.7%

        \[\leadsto {\left(\mathsf{fma}\left(-0.5, \frac{a}{b}, \frac{-2 \cdot b}{\color{blue}{-3} \cdot c}\right)\right)}^{-1} \cdot -0.3333333333333333 \]
      7. times-frac82.8%

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

        \[\leadsto {\left(\mathsf{fma}\left(-0.5, \frac{a}{b}, \color{blue}{0.6666666666666666} \cdot \frac{b}{c}\right)\right)}^{-1} \cdot -0.3333333333333333 \]
    13. Simplified82.8%

      \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(-0.5, \frac{a}{b}, 0.6666666666666666 \cdot \frac{b}{c}\right)\right)}}^{-1} \cdot -0.3333333333333333 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification83.5%

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

Alternative 2: 77.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}\\ \mathbf{if}\;b \leq -1.18 \cdot 10^{+80}:\\ \;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq -7.2 \cdot 10^{+14}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq -1.6 \cdot 10^{-8}:\\ \;\;\;\;\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \frac{0.5}{\frac{b}{c}}\right)\\ \mathbf{elif}\;b \leq 1.8 \cdot 10^{-52}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* 0.3333333333333333 (/ (- (sqrt (* a (* c -3.0))) b) a))))
   (if (<= b -1.18e+80)
     (/ (- (- (/ (* a 1.5) (/ b c)) b) b) (* a 3.0))
     (if (<= b -7.2e+14)
       t_0
       (if (<= b -1.6e-8)
         (fma b (/ -0.6666666666666666 a) (/ 0.5 (/ b c)))
         (if (<= b 1.8e-52) t_0 (/ (* c -0.5) b)))))))
double code(double a, double b, double c) {
	double t_0 = 0.3333333333333333 * ((sqrt((a * (c * -3.0))) - b) / a);
	double tmp;
	if (b <= -1.18e+80) {
		tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
	} else if (b <= -7.2e+14) {
		tmp = t_0;
	} else if (b <= -1.6e-8) {
		tmp = fma(b, (-0.6666666666666666 / a), (0.5 / (b / c)));
	} else if (b <= 1.8e-52) {
		tmp = t_0;
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(0.3333333333333333 * Float64(Float64(sqrt(Float64(a * Float64(c * -3.0))) - b) / a))
	tmp = 0.0
	if (b <= -1.18e+80)
		tmp = Float64(Float64(Float64(Float64(Float64(a * 1.5) / Float64(b / c)) - b) - b) / Float64(a * 3.0));
	elseif (b <= -7.2e+14)
		tmp = t_0;
	elseif (b <= -1.6e-8)
		tmp = fma(b, Float64(-0.6666666666666666 / a), Float64(0.5 / Float64(b / c)));
	elseif (b <= 1.8e-52)
		tmp = t_0;
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.18e+80], N[(N[(N[(N[(N[(a * 1.5), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -7.2e+14], t$95$0, If[LessEqual[b, -1.6e-8], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision] + N[(0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.8e-52], t$95$0, N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}\\
\mathbf{if}\;b \leq -1.18 \cdot 10^{+80}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\

\mathbf{elif}\;b \leq -7.2 \cdot 10^{+14}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;b \leq -1.6 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \frac{0.5}{\frac{b}{c}}\right)\\

\mathbf{elif}\;b \leq 1.8 \cdot 10^{-52}:\\
\;\;\;\;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.18e80

    1. Initial program 58.1%

      \[\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 91.8%

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

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

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

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

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

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

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

    if -1.18e80 < b < -7.2e14 or -1.6000000000000001e-8 < b < 1.79999999999999994e-52

    1. Initial program 78.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.2e14 < b < -1.6000000000000001e-8

    1. Initial program 83.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 83.5%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} + 0.5 \cdot \frac{c}{b} \]
      2. *-commutative83.8%

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

        \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} + 0.5 \cdot \frac{c}{b} \]
      4. fma-def83.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, 0.5 \cdot \frac{c}{b}\right)} \]
      5. associate-*r/83.8%

        \[\leadsto \mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \color{blue}{\frac{0.5 \cdot c}{b}}\right) \]
      6. associate-/l*83.8%

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

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

    if 1.79999999999999994e-52 < b

    1. Initial program 16.1%

      \[\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 82.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.18 \cdot 10^{+80}:\\ \;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq -7.2 \cdot 10^{+14}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}\\ \mathbf{elif}\;b \leq -1.6 \cdot 10^{-8}:\\ \;\;\;\;\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \frac{0.5}{\frac{b}{c}}\right)\\ \mathbf{elif}\;b \leq 1.8 \cdot 10^{-52}:\\ \;\;\;\;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 3: 77.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{a \cdot \left(c \cdot -3\right)} - b\\ \mathbf{if}\;b \leq -1.18 \cdot 10^{+80}:\\ \;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq -7.2 \cdot 10^{+14}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{t_0}{a}\\ \mathbf{elif}\;b \leq -3.8 \cdot 10^{-8}:\\ \;\;\;\;\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \frac{0.5}{\frac{b}{c}}\right)\\ \mathbf{elif}\;b \leq 3.6 \cdot 10^{-52}:\\ \;\;\;\;\frac{t_0}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (- (sqrt (* a (* c -3.0))) b)))
   (if (<= b -1.18e+80)
     (/ (- (- (/ (* a 1.5) (/ b c)) b) b) (* a 3.0))
     (if (<= b -7.2e+14)
       (* 0.3333333333333333 (/ t_0 a))
       (if (<= b -3.8e-8)
         (fma b (/ -0.6666666666666666 a) (/ 0.5 (/ b c)))
         (if (<= b 3.6e-52) (/ t_0 (* a 3.0)) (/ (* c -0.5) b)))))))
double code(double a, double b, double c) {
	double t_0 = sqrt((a * (c * -3.0))) - b;
	double tmp;
	if (b <= -1.18e+80) {
		tmp = ((((a * 1.5) / (b / c)) - b) - b) / (a * 3.0);
	} else if (b <= -7.2e+14) {
		tmp = 0.3333333333333333 * (t_0 / a);
	} else if (b <= -3.8e-8) {
		tmp = fma(b, (-0.6666666666666666 / a), (0.5 / (b / c)));
	} else if (b <= 3.6e-52) {
		tmp = t_0 / (a * 3.0);
	} else {
		tmp = (c * -0.5) / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(sqrt(Float64(a * Float64(c * -3.0))) - b)
	tmp = 0.0
	if (b <= -1.18e+80)
		tmp = Float64(Float64(Float64(Float64(Float64(a * 1.5) / Float64(b / c)) - b) - b) / Float64(a * 3.0));
	elseif (b <= -7.2e+14)
		tmp = Float64(0.3333333333333333 * Float64(t_0 / a));
	elseif (b <= -3.8e-8)
		tmp = fma(b, Float64(-0.6666666666666666 / a), Float64(0.5 / Float64(b / c)));
	elseif (b <= 3.6e-52)
		tmp = Float64(t_0 / Float64(a * 3.0));
	else
		tmp = Float64(Float64(c * -0.5) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[b, -1.18e+80], N[(N[(N[(N[(N[(a * 1.5), $MachinePrecision] / N[(b / c), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -7.2e+14], N[(0.3333333333333333 * N[(t$95$0 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -3.8e-8], N[(b * N[(-0.6666666666666666 / a), $MachinePrecision] + N[(0.5 / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.6e-52], N[(t$95$0 / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq -7.2 \cdot 10^{+14}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{t_0}{a}\\

\mathbf{elif}\;b \leq -3.8 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \frac{0.5}{\frac{b}{c}}\right)\\

\mathbf{elif}\;b \leq 3.6 \cdot 10^{-52}:\\
\;\;\;\;\frac{t_0}{a \cdot 3}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if b < -1.18e80

    1. Initial program 58.1%

      \[\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 91.8%

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

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

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

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

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

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

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

    if -1.18e80 < b < -7.2e14

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.2e14 < b < -3.80000000000000028e-8

    1. Initial program 83.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 83.5%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} + 0.5 \cdot \frac{c}{b} \]
      2. *-commutative83.8%

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

        \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} + 0.5 \cdot \frac{c}{b} \]
      4. fma-def83.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, 0.5 \cdot \frac{c}{b}\right)} \]
      5. associate-*r/83.8%

        \[\leadsto \mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \color{blue}{\frac{0.5 \cdot c}{b}}\right) \]
      6. associate-/l*83.8%

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

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

    if -3.80000000000000028e-8 < b < 3.59999999999999988e-52

    1. Initial program 74.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.59999999999999988e-52 < b

    1. Initial program 16.1%

      \[\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 82.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.18 \cdot 10^{+80}:\\ \;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq -7.2 \cdot 10^{+14}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}\\ \mathbf{elif}\;b \leq -3.8 \cdot 10^{-8}:\\ \;\;\;\;\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \frac{0.5}{\frac{b}{c}}\right)\\ \mathbf{elif}\;b \leq 3.6 \cdot 10^{-52}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 77.3% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;b \leq -2.6 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \frac{0.5}{\frac{b}{c}}\right)\\

\mathbf{elif}\;b \leq 1.45 \cdot 10^{-54}:\\
\;\;\;\;\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 5 regimes
  2. if b < -1.18e80

    1. Initial program 58.1%

      \[\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 91.8%

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

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

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

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

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

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

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

    if -1.18e80 < b < -7.2e14

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.2e14 < b < -2.6000000000000001e-8

    1. Initial program 83.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 83.5%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666 \cdot b}{a}} + 0.5 \cdot \frac{c}{b} \]
      2. *-commutative83.8%

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

        \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} + 0.5 \cdot \frac{c}{b} \]
      4. fma-def83.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, 0.5 \cdot \frac{c}{b}\right)} \]
      5. associate-*r/83.8%

        \[\leadsto \mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \color{blue}{\frac{0.5 \cdot c}{b}}\right) \]
      6. associate-/l*83.8%

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

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

    if -2.6000000000000001e-8 < b < 1.45000000000000007e-54

    1. Initial program 74.7%

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

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

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

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

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

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

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

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

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

    if 1.45000000000000007e-54 < b

    1. Initial program 16.1%

      \[\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 82.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.18 \cdot 10^{+80}:\\ \;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq -7.2 \cdot 10^{+14}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{a \cdot \left(c \cdot -3\right)} - b}{a}\\ \mathbf{elif}\;b \leq -2.6 \cdot 10^{-8}:\\ \;\;\;\;\mathsf{fma}\left(b, \frac{-0.6666666666666666}{a}, \frac{0.5}{\frac{b}{c}}\right)\\ \mathbf{elif}\;b \leq 1.45 \cdot 10^{-54}:\\ \;\;\;\;\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 5: 86.3% accurate, 0.9× speedup?

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

\mathbf{elif}\;b \leq 4.2 \cdot 10^{-49}:\\
\;\;\;\;\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 < -2.1000000000000002e140

    1. Initial program 41.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 94.5%

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(\left(\frac{b}{a} \cdot -0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot -0.6666666666666666\right)\right) \cdot \left(\frac{b}{a} \cdot -0.6666666666666666\right)\right)}^{0.3333333333333333}} \]
      3. pow334.3%

        \[\leadsto {\color{blue}{\left({\left(\frac{b}{a} \cdot -0.6666666666666666\right)}^{3}\right)}}^{0.3333333333333333} \]
    7. Applied egg-rr34.3%

      \[\leadsto \color{blue}{{\left({\left(\frac{b}{a} \cdot -0.6666666666666666\right)}^{3}\right)}^{0.3333333333333333}} \]
    8. Step-by-step derivation
      1. unpow1/360.9%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{b}{a} \cdot -0.6666666666666666\right)}^{3}}} \]
      2. rem-cbrt-cube94.5%

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      3. metadata-eval94.5%

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

        \[\leadsto \color{blue}{\frac{b \cdot -2}{a \cdot 3}} \]
      5. associate-/l/94.7%

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

        \[\leadsto \frac{\color{blue}{\frac{b}{\frac{3}{-2}}}}{a} \]
      7. metadata-eval94.7%

        \[\leadsto \frac{\frac{b}{\color{blue}{-1.5}}}{a} \]
    9. Applied egg-rr94.7%

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

    if -2.1000000000000002e140 < b < 4.1999999999999998e-49

    1. Initial program 80.7%

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

    if 4.1999999999999998e-49 < b

    1. Initial program 16.1%

      \[\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 82.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.1 \cdot 10^{+140}:\\ \;\;\;\;\frac{\frac{b}{-1.5}}{a}\\ \mathbf{elif}\;b \leq 4.2 \cdot 10^{-49}:\\ \;\;\;\;\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 6: 68.4% accurate, 5.8× speedup?

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

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

    1. Initial program 74.3%

      \[\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 60.3%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 33.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 63.2%

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

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

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

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

Alternative 7: 68.5% accurate, 7.2× speedup?

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

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

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


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

    1. Initial program 74.3%

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 33.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 63.2%

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

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

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

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

Alternative 8: 44.3% accurate, 11.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 3.49999999999999998e34

    1. Initial program 66.1%

      \[\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 38.5%

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

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

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

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

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
      3. un-div-inv38.6%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    7. Applied egg-rr38.6%

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

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

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

    if 3.49999999999999998e34 < b

    1. Initial program 13.8%

      \[\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 2.2%

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

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

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

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

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

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

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

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

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

Alternative 9: 44.3% accurate, 11.6× speedup?

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

    1. Initial program 66.1%

      \[\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 38.5%

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

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

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

    if 6.8000000000000002e35 < b

    1. Initial program 13.8%

      \[\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 2.2%

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

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

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

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

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

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

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

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

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

Alternative 10: 44.3% accurate, 11.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 3.3999999999999999e34

    1. Initial program 66.1%

      \[\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 38.5%

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

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

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

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

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
      3. un-div-inv38.6%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    7. Applied egg-rr38.6%

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

    if 3.3999999999999999e34 < b

    1. Initial program 13.8%

      \[\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 2.2%

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

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

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

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

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

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

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

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

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

Alternative 11: 67.9% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 74.1%

      \[\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 60.2%

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

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

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

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

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
      3. un-div-inv60.3%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    7. Applied egg-rr60.3%

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

    if 1.34999999999999999e-290 < b

    1. Initial program 32.8%

      \[\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 64.5%

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

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

        \[\leadsto \color{blue}{\frac{-0.5}{\frac{b}{c}}} \]
    5. Simplified64.0%

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

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

Alternative 12: 68.3% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 74.1%

      \[\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 60.2%

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

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

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

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

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
      3. un-div-inv60.3%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    7. Applied egg-rr60.3%

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

    if 1.34999999999999999e-290 < b

    1. Initial program 32.8%

      \[\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 64.5%

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

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

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

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

Alternative 13: 68.4% accurate, 11.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.35 \cdot 10^{-290}:\\
\;\;\;\;\frac{\frac{b}{-1.5}}{a}\\

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


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

    1. Initial program 74.1%

      \[\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 60.2%

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(\left(\frac{b}{a} \cdot -0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot -0.6666666666666666\right)\right) \cdot \left(\frac{b}{a} \cdot -0.6666666666666666\right)\right)}^{0.3333333333333333}} \]
      3. pow317.9%

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

      \[\leadsto \color{blue}{{\left({\left(\frac{b}{a} \cdot -0.6666666666666666\right)}^{3}\right)}^{0.3333333333333333}} \]
    8. Step-by-step derivation
      1. unpow1/333.8%

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

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

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

        \[\leadsto \color{blue}{\frac{b \cdot -2}{a \cdot 3}} \]
      5. associate-/l/60.3%

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

        \[\leadsto \frac{\color{blue}{\frac{b}{\frac{3}{-2}}}}{a} \]
      7. metadata-eval60.3%

        \[\leadsto \frac{\frac{b}{\color{blue}{-1.5}}}{a} \]
    9. Applied egg-rr60.3%

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

    if 1.34999999999999999e-290 < b

    1. Initial program 32.8%

      \[\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 64.5%

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

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

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

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

Alternative 14: 10.9% 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 51.0%

    \[\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 27.1%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b}} \]
  7. Final simplification10.0%

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

Reproduce

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