Cubic critical

Percentage Accurate: 51.2% → 84.9%
Time: 13.7s
Alternatives: 17
Speedup: 16.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 51.2% accurate, 1.0× speedup?

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

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

Alternative 1: 84.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 49.6%

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

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

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

      \[\leadsto \frac{\color{blue}{b \cdot -2}}{3 \cdot a} \]
    5. Step-by-step derivation
      1. times-frac99.8%

        \[\leadsto \color{blue}{\frac{b}{3} \cdot \frac{-2}{a}} \]
    6. Applied egg-rr99.8%

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

    if -2.0000000000000001e152 < b < 9.20000000000000028e-10

    1. Initial program 80.7%

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

    if 9.20000000000000028e-10 < b

    1. Initial program 8.0%

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

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

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

Alternative 2: 84.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 49.6%

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

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

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

      \[\leadsto \frac{\color{blue}{b \cdot -2}}{3 \cdot a} \]
    5. Step-by-step derivation
      1. times-frac99.8%

        \[\leadsto \color{blue}{\frac{b}{3} \cdot \frac{-2}{a}} \]
    6. Applied egg-rr99.8%

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

    if -2.79999999999999987e151 < b < 9.20000000000000028e-10

    1. Initial program 80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.20000000000000028e-10 < b

    1. Initial program 8.0%

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

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

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

Alternative 3: 84.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 50.6%

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

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

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

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

    if -7.8e146 < b < 7.49999999999999995e-10

    1. Initial program 80.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.49999999999999995e-10 < b

    1. Initial program 8.0%

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

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

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

Alternative 4: 84.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 49.6%

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

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

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

      \[\leadsto \frac{\color{blue}{b \cdot -2}}{3 \cdot a} \]
    5. Step-by-step derivation
      1. times-frac99.8%

        \[\leadsto \color{blue}{\frac{b}{3} \cdot \frac{-2}{a}} \]
    6. Applied egg-rr99.8%

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

    if -2.7000000000000001e151 < b < 6.99999999999999961e-10

    1. Initial program 80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.99999999999999961e-10 < b

    1. Initial program 8.0%

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

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

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

Alternative 5: 84.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 49.6%

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

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

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

      \[\leadsto \frac{\color{blue}{b \cdot -2}}{3 \cdot a} \]
    5. Step-by-step derivation
      1. times-frac99.8%

        \[\leadsto \color{blue}{\frac{b}{3} \cdot \frac{-2}{a}} \]
    6. Applied egg-rr99.8%

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

    if -6.39999999999999988e151 < b < 5.99999999999999996e-9

    1. Initial program 80.7%

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

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

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

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

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

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

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

    if 5.99999999999999996e-9 < b

    1. Initial program 8.0%

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

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

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

Alternative 6: 84.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 49.6%

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

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

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

      \[\leadsto \frac{\color{blue}{b \cdot -2}}{3 \cdot a} \]
    5. Step-by-step derivation
      1. times-frac99.8%

        \[\leadsto \color{blue}{\frac{b}{3} \cdot \frac{-2}{a}} \]
    6. Applied egg-rr99.8%

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

    if -8.4999999999999993e152 < b < 8.00000000000000029e-10

    1. Initial program 80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.00000000000000029e-10 < b

    1. Initial program 8.0%

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

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

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

Alternative 7: 79.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 70.5%

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

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

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

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

    if -1.62000000000000007e-74 < b < 7.2e-10

    1. Initial program 74.0%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + {\color{blue}{\left(\left(a \cdot -3\right) \cdot c\right)}}^{0.5}}{3 \cdot a} \]
      3. unpow-prod-down47.8%

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(a \cdot -3\right)}^{0.5} \cdot {c}^{0.5}}}{3 \cdot a} \]
      4. pow1/247.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.2e-10 < b

    1. Initial program 8.0%

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

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

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

Alternative 8: 79.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 70.5%

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

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

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

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

    if -1.45e-74 < b < 6.99999999999999961e-10

    1. Initial program 74.0%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + {\color{blue}{\left(\left(a \cdot -3\right) \cdot c\right)}}^{0.5}}{3 \cdot a} \]
      3. unpow-prod-down47.8%

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(a \cdot -3\right)}^{0.5} \cdot {c}^{0.5}}}{3 \cdot a} \]
      4. pow1/247.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.99999999999999961e-10 < b

    1. Initial program 8.0%

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

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

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

Alternative 9: 79.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 70.5%

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

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

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

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

    if -1.62000000000000007e-74 < b < 7.2e-10

    1. Initial program 74.0%

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

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

    if 7.2e-10 < b

    1. Initial program 8.0%

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

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

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

Alternative 10: 80.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 70.5%

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

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

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

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

    if -1.62000000000000007e-74 < b < 6.99999999999999961e-10

    1. Initial program 74.0%

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

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

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

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

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

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

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

    if 6.99999999999999961e-10 < b

    1. Initial program 8.0%

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

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

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

Alternative 11: 67.9% accurate, 8.9× speedup?

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

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

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


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

    1. Initial program 74.9%

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 29.8%

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

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

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

Alternative 12: 67.9% accurate, 8.9× speedup?

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

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

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


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

    1. Initial program 74.9%

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 29.8%

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

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

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

Alternative 13: 67.7% accurate, 12.8× speedup?

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

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

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


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

    1. Initial program 75.8%

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

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

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

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

    if 5.9999999999999999e-267 < b

    1. Initial program 26.9%

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

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

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

Alternative 14: 67.7% accurate, 16.4× speedup?

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

    1. Initial program 75.8%

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

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

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

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

        \[\leadsto \color{blue}{\left(b \cdot -2\right) \cdot \frac{1}{3 \cdot a}} \]
    6. Applied egg-rr65.5%

      \[\leadsto \color{blue}{\left(b \cdot -2\right) \cdot \frac{1}{3 \cdot a}} \]
    7. Step-by-step derivation
      1. associate-*l*65.5%

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

        \[\leadsto b \cdot \left(-2 \cdot \color{blue}{\frac{\frac{1}{3}}{a}}\right) \]
      3. metadata-eval65.5%

        \[\leadsto b \cdot \left(-2 \cdot \frac{\color{blue}{0.3333333333333333}}{a}\right) \]
      4. associate-*r/65.5%

        \[\leadsto b \cdot \color{blue}{\frac{-2 \cdot 0.3333333333333333}{a}} \]
      5. metadata-eval65.5%

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

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

    if 5.9999999999999999e-267 < b

    1. Initial program 26.9%

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

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

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

Alternative 15: 67.7% accurate, 16.4× speedup?

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

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

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


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

    1. Initial program 75.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      2. associate-/r/65.6%

        \[\leadsto \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}} \]
    8. Simplified65.6%

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

    if 5.9999999999999999e-267 < b

    1. Initial program 26.9%

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

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

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

Alternative 16: 67.7% accurate, 16.4× speedup?

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

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

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


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

    1. Initial program 75.8%

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

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

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

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

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

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

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

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

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

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

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

    if 5.9999999999999999e-267 < b

    1. Initial program 26.9%

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

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

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

Alternative 17: 35.7% accurate, 23.2× speedup?

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

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

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

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

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

Reproduce

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