Cubic critical

Percentage Accurate: 52.8% → 85.8%
Time: 16.3s
Alternatives: 10
Speedup: 11.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 52.8% accurate, 1.0× speedup?

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

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

Alternative 1: 85.8% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 37.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Applied egg-rr1.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    10. Simplified0.7%

      \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt0.3%

        \[\leadsto \color{blue}{\sqrt{\frac{b}{a} \cdot 0.6666666666666666} \cdot \sqrt{\frac{b}{a} \cdot 0.6666666666666666}} \]
      2. sqrt-unprod43.1%

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

        \[\leadsto \sqrt{\color{blue}{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \left(0.6666666666666666 \cdot 0.6666666666666666\right)}} \]
      4. metadata-eval43.2%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{0.4444444444444444}} \]
      5. metadata-eval43.2%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{\left(-0.6666666666666666 \cdot -0.6666666666666666\right)}} \]
      6. swap-sqr43.1%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{b}{a} \cdot -0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot -0.6666666666666666\right)}} \]
      7. sqrt-unprod55.4%

        \[\leadsto \color{blue}{\sqrt{\frac{b}{a} \cdot -0.6666666666666666} \cdot \sqrt{\frac{b}{a} \cdot -0.6666666666666666}} \]
      8. add-sqr-sqrt97.4%

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      9. *-commutative97.4%

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
      10. clear-num97.4%

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
      11. un-div-inv97.5%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    12. Applied egg-rr97.5%

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

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

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

    if -4.9999999999999999e155 < b < 3.79999999999999994e-33

    1. Initial program 79.2%

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

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

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

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

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

    if 3.79999999999999994e-33 < b

    1. Initial program 17.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. sqr-neg17.6%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Applied egg-rr23.1%

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

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

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

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{b}} \]
    9. Step-by-step derivation
      1. metadata-eval0.0%

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

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

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{-3}}{b} \]
      4. metadata-eval81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{\left(-3\right)}}{b} \]
      5. distribute-rgt-neg-in81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{\color{blue}{-c \cdot 3}}{b} \]
      6. distribute-frac-neg81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\left(-\frac{c \cdot 3}{b}\right)} \]
      7. distribute-frac-neg281.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\frac{c \cdot 3}{-b}} \]
      8. times-frac81.8%

        \[\leadsto \color{blue}{\frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{-1 \cdot \left(-b\right)}} \]
      9. neg-mul-181.8%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{-\left(-b\right)}} \]
      10. remove-double-neg81.8%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{b}} \]
      11. *-commutative81.8%

        \[\leadsto \frac{\color{blue}{\left(c \cdot 3\right) \cdot -0.16666666666666666}}{b} \]
      12. associate-*l*82.1%

        \[\leadsto \frac{\color{blue}{c \cdot \left(3 \cdot -0.16666666666666666\right)}}{b} \]
      13. metadata-eval82.1%

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

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

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

Alternative 2: 80.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 69.9%

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

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

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

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

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

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

    if -2.2999999999999999e-54 < b < 3.4000000000000001e-33

    1. Initial program 67.1%

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

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

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

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

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

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

    if 3.4000000000000001e-33 < b

    1. Initial program 17.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. sqr-neg17.6%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Applied egg-rr23.1%

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

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

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

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{b}} \]
    9. Step-by-step derivation
      1. metadata-eval0.0%

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

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

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{-3}}{b} \]
      4. metadata-eval81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{\left(-3\right)}}{b} \]
      5. distribute-rgt-neg-in81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{\color{blue}{-c \cdot 3}}{b} \]
      6. distribute-frac-neg81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\left(-\frac{c \cdot 3}{b}\right)} \]
      7. distribute-frac-neg281.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\frac{c \cdot 3}{-b}} \]
      8. times-frac81.8%

        \[\leadsto \color{blue}{\frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{-1 \cdot \left(-b\right)}} \]
      9. neg-mul-181.8%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{-\left(-b\right)}} \]
      10. remove-double-neg81.8%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{b}} \]
      11. *-commutative81.8%

        \[\leadsto \frac{\color{blue}{\left(c \cdot 3\right) \cdot -0.16666666666666666}}{b} \]
      12. associate-*l*82.1%

        \[\leadsto \frac{\color{blue}{c \cdot \left(3 \cdot -0.16666666666666666\right)}}{b} \]
      13. metadata-eval82.1%

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

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

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

Alternative 3: 80.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    10. Simplified1.0%

      \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt0.5%

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

        \[\leadsto \color{blue}{\sqrt{\left(\frac{b}{a} \cdot 0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot 0.6666666666666666\right)}} \]
      3. swap-sqr33.5%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \left(0.6666666666666666 \cdot 0.6666666666666666\right)}} \]
      4. metadata-eval33.5%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{0.4444444444444444}} \]
      5. metadata-eval33.5%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{\left(-0.6666666666666666 \cdot -0.6666666666666666\right)}} \]
      6. swap-sqr33.5%

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

        \[\leadsto \color{blue}{\sqrt{\frac{b}{a} \cdot -0.6666666666666666} \cdot \sqrt{\frac{b}{a} \cdot -0.6666666666666666}} \]
      8. add-sqr-sqrt89.1%

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      9. *-commutative89.1%

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
      10. clear-num89.1%

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    12. Applied egg-rr89.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    16. Applied egg-rr89.2%

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

    if -3.7999999999999997e-57 < b < 3.4000000000000001e-33

    1. Initial program 67.1%

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

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

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

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

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

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

    if 3.4000000000000001e-33 < b

    1. Initial program 17.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. sqr-neg17.6%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Applied egg-rr23.1%

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

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

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

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{b}} \]
    9. Step-by-step derivation
      1. metadata-eval0.0%

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

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

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{-3}}{b} \]
      4. metadata-eval81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{\left(-3\right)}}{b} \]
      5. distribute-rgt-neg-in81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{\color{blue}{-c \cdot 3}}{b} \]
      6. distribute-frac-neg81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\left(-\frac{c \cdot 3}{b}\right)} \]
      7. distribute-frac-neg281.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\frac{c \cdot 3}{-b}} \]
      8. times-frac81.8%

        \[\leadsto \color{blue}{\frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{-1 \cdot \left(-b\right)}} \]
      9. neg-mul-181.8%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{-\left(-b\right)}} \]
      10. remove-double-neg81.8%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{b}} \]
      11. *-commutative81.8%

        \[\leadsto \frac{\color{blue}{\left(c \cdot 3\right) \cdot -0.16666666666666666}}{b} \]
      12. associate-*l*82.1%

        \[\leadsto \frac{\color{blue}{c \cdot \left(3 \cdot -0.16666666666666666\right)}}{b} \]
      13. metadata-eval82.1%

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

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

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

Alternative 4: 80.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    10. Simplified1.0%

      \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt0.5%

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

        \[\leadsto \color{blue}{\sqrt{\left(\frac{b}{a} \cdot 0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot 0.6666666666666666\right)}} \]
      3. swap-sqr33.5%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \left(0.6666666666666666 \cdot 0.6666666666666666\right)}} \]
      4. metadata-eval33.5%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{0.4444444444444444}} \]
      5. metadata-eval33.5%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{\left(-0.6666666666666666 \cdot -0.6666666666666666\right)}} \]
      6. swap-sqr33.5%

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

        \[\leadsto \color{blue}{\sqrt{\frac{b}{a} \cdot -0.6666666666666666} \cdot \sqrt{\frac{b}{a} \cdot -0.6666666666666666}} \]
      8. add-sqr-sqrt89.1%

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      9. *-commutative89.1%

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
      10. clear-num89.1%

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    12. Applied egg-rr89.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    16. Applied egg-rr89.2%

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

    if -4.5000000000000001e-56 < b < 5.80000000000000005e-33

    1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.80000000000000005e-33 < b

    1. Initial program 17.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. sqr-neg17.6%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Applied egg-rr23.1%

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

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

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

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{b}} \]
    9. Step-by-step derivation
      1. metadata-eval0.0%

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

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

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{-3}}{b} \]
      4. metadata-eval81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{\left(-3\right)}}{b} \]
      5. distribute-rgt-neg-in81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{\color{blue}{-c \cdot 3}}{b} \]
      6. distribute-frac-neg81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\left(-\frac{c \cdot 3}{b}\right)} \]
      7. distribute-frac-neg281.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\frac{c \cdot 3}{-b}} \]
      8. times-frac81.8%

        \[\leadsto \color{blue}{\frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{-1 \cdot \left(-b\right)}} \]
      9. neg-mul-181.8%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{-\left(-b\right)}} \]
      10. remove-double-neg81.8%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{b}} \]
      11. *-commutative81.8%

        \[\leadsto \frac{\color{blue}{\left(c \cdot 3\right) \cdot -0.16666666666666666}}{b} \]
      12. associate-*l*82.1%

        \[\leadsto \frac{\color{blue}{c \cdot \left(3 \cdot -0.16666666666666666\right)}}{b} \]
      13. metadata-eval82.1%

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

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

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

Alternative 5: 80.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    10. Simplified1.0%

      \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt0.5%

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

        \[\leadsto \color{blue}{\sqrt{\left(\frac{b}{a} \cdot 0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot 0.6666666666666666\right)}} \]
      3. swap-sqr33.5%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \left(0.6666666666666666 \cdot 0.6666666666666666\right)}} \]
      4. metadata-eval33.5%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{0.4444444444444444}} \]
      5. metadata-eval33.5%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{\left(-0.6666666666666666 \cdot -0.6666666666666666\right)}} \]
      6. swap-sqr33.5%

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

        \[\leadsto \color{blue}{\sqrt{\frac{b}{a} \cdot -0.6666666666666666} \cdot \sqrt{\frac{b}{a} \cdot -0.6666666666666666}} \]
      8. add-sqr-sqrt89.1%

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      9. *-commutative89.1%

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
      10. clear-num89.1%

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    12. Applied egg-rr89.1%

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    16. Applied egg-rr89.2%

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

    if -1.15999999999999996e-57 < b < 3.2000000000000002e-32

    1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{a}} \]
    10. Taylor expanded in a around 0 60.4%

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

    if 3.2000000000000002e-32 < b

    1. Initial program 17.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. sqr-neg17.6%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Applied egg-rr23.1%

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

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

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

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{b}} \]
    9. Step-by-step derivation
      1. metadata-eval0.0%

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

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

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{-3}}{b} \]
      4. metadata-eval81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{\left(-3\right)}}{b} \]
      5. distribute-rgt-neg-in81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{\color{blue}{-c \cdot 3}}{b} \]
      6. distribute-frac-neg81.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\left(-\frac{c \cdot 3}{b}\right)} \]
      7. distribute-frac-neg281.6%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\frac{c \cdot 3}{-b}} \]
      8. times-frac81.8%

        \[\leadsto \color{blue}{\frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{-1 \cdot \left(-b\right)}} \]
      9. neg-mul-181.8%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{-\left(-b\right)}} \]
      10. remove-double-neg81.8%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{b}} \]
      11. *-commutative81.8%

        \[\leadsto \frac{\color{blue}{\left(c \cdot 3\right) \cdot -0.16666666666666666}}{b} \]
      12. associate-*l*82.1%

        \[\leadsto \frac{\color{blue}{c \cdot \left(3 \cdot -0.16666666666666666\right)}}{b} \]
      13. metadata-eval82.1%

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

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

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

Alternative 6: 71.5% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    10. Simplified1.1%

      \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt0.6%

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

        \[\leadsto \color{blue}{\sqrt{\left(\frac{b}{a} \cdot 0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot 0.6666666666666666\right)}} \]
      3. swap-sqr32.3%

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

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{0.4444444444444444}} \]
      5. metadata-eval32.3%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{\left(-0.6666666666666666 \cdot -0.6666666666666666\right)}} \]
      6. swap-sqr32.2%

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

        \[\leadsto \color{blue}{\sqrt{\frac{b}{a} \cdot -0.6666666666666666} \cdot \sqrt{\frac{b}{a} \cdot -0.6666666666666666}} \]
      8. add-sqr-sqrt84.2%

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

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

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
      11. un-div-inv84.2%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    12. Applied egg-rr84.2%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}} \]
      4. div-inv84.3%

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    16. Applied egg-rr84.3%

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

    if -4.50000000000000008e-138 < b < 1.3199999999999999e-199

    1. Initial program 69.8%

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-3}\right)}^{3}}{a}}\right) \cdot -0.3333333333333333 \]
      4. rem-square-sqrt41.8%

        \[\leadsto \left(\color{blue}{-1} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-3}\right)}^{3}}{a}}\right) \cdot -0.3333333333333333 \]
      5. rem-cube-cbrt42.0%

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

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

    if 1.3199999999999999e-199 < b

    1. Initial program 26.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{b}} \]
    9. Step-by-step derivation
      1. metadata-eval0.0%

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

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{b} \]
      3. rem-square-sqrt70.3%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{-3}}{b} \]
      4. metadata-eval70.3%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{\left(-3\right)}}{b} \]
      5. distribute-rgt-neg-in70.3%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{\color{blue}{-c \cdot 3}}{b} \]
      6. distribute-frac-neg70.3%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\left(-\frac{c \cdot 3}{b}\right)} \]
      7. distribute-frac-neg270.3%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\frac{c \cdot 3}{-b}} \]
      8. times-frac70.5%

        \[\leadsto \color{blue}{\frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{-1 \cdot \left(-b\right)}} \]
      9. neg-mul-170.5%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{-\left(-b\right)}} \]
      10. remove-double-neg70.5%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{b}} \]
      11. *-commutative70.5%

        \[\leadsto \frac{\color{blue}{\left(c \cdot 3\right) \cdot -0.16666666666666666}}{b} \]
      12. associate-*l*70.7%

        \[\leadsto \frac{\color{blue}{c \cdot \left(3 \cdot -0.16666666666666666\right)}}{b} \]
      13. metadata-eval70.7%

        \[\leadsto \frac{c \cdot \color{blue}{-0.5}}{b} \]
    10. Simplified70.7%

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

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

Alternative 7: 67.1% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    10. Simplified1.4%

      \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt0.8%

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

        \[\leadsto \color{blue}{\sqrt{\left(\frac{b}{a} \cdot 0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot 0.6666666666666666\right)}} \]
      3. swap-sqr28.5%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \left(0.6666666666666666 \cdot 0.6666666666666666\right)}} \]
      4. metadata-eval28.5%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{0.4444444444444444}} \]
      5. metadata-eval28.5%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{\left(-0.6666666666666666 \cdot -0.6666666666666666\right)}} \]
      6. swap-sqr28.5%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{b}{a} \cdot -0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot -0.6666666666666666\right)}} \]
      7. sqrt-unprod41.0%

        \[\leadsto \color{blue}{\sqrt{\frac{b}{a} \cdot -0.6666666666666666} \cdot \sqrt{\frac{b}{a} \cdot -0.6666666666666666}} \]
      8. add-sqr-sqrt73.9%

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

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
      10. clear-num73.9%

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
      11. un-div-inv73.9%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    12. Applied egg-rr73.9%

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
    14. Simplified74.0%

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

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

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

        \[\leadsto \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}} \]
      4. div-inv74.0%

        \[\leadsto \frac{b}{\color{blue}{a \cdot \frac{1}{-0.6666666666666666}}} \]
      5. metadata-eval74.0%

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    16. Applied egg-rr74.0%

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

    if -4.999999999999985e-310 < b

    1. Initial program 31.4%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Applied egg-rr35.0%

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

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

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

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

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

      \[\leadsto \color{blue}{0.16666666666666666 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{b}} \]
    9. Step-by-step derivation
      1. metadata-eval0.0%

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

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{b} \]
      3. rem-square-sqrt62.4%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{-3}}{b} \]
      4. metadata-eval62.4%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{c \cdot \color{blue}{\left(-3\right)}}{b} \]
      5. distribute-rgt-neg-in62.4%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \frac{\color{blue}{-c \cdot 3}}{b} \]
      6. distribute-frac-neg62.4%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\left(-\frac{c \cdot 3}{b}\right)} \]
      7. distribute-frac-neg262.4%

        \[\leadsto \frac{-0.16666666666666666}{-1} \cdot \color{blue}{\frac{c \cdot 3}{-b}} \]
      8. times-frac62.6%

        \[\leadsto \color{blue}{\frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{-1 \cdot \left(-b\right)}} \]
      9. neg-mul-162.6%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{-\left(-b\right)}} \]
      10. remove-double-neg62.6%

        \[\leadsto \frac{-0.16666666666666666 \cdot \left(c \cdot 3\right)}{\color{blue}{b}} \]
      11. *-commutative62.6%

        \[\leadsto \frac{\color{blue}{\left(c \cdot 3\right) \cdot -0.16666666666666666}}{b} \]
      12. associate-*l*62.8%

        \[\leadsto \frac{\color{blue}{c \cdot \left(3 \cdot -0.16666666666666666\right)}}{b} \]
      13. metadata-eval62.8%

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

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

Alternative 8: 67.1% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    10. Simplified1.4%

      \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt0.8%

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

        \[\leadsto \color{blue}{\sqrt{\left(\frac{b}{a} \cdot 0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot 0.6666666666666666\right)}} \]
      3. swap-sqr28.5%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \left(0.6666666666666666 \cdot 0.6666666666666666\right)}} \]
      4. metadata-eval28.5%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{0.4444444444444444}} \]
      5. metadata-eval28.5%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{\left(-0.6666666666666666 \cdot -0.6666666666666666\right)}} \]
      6. swap-sqr28.5%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{b}{a} \cdot -0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot -0.6666666666666666\right)}} \]
      7. sqrt-unprod41.0%

        \[\leadsto \color{blue}{\sqrt{\frac{b}{a} \cdot -0.6666666666666666} \cdot \sqrt{\frac{b}{a} \cdot -0.6666666666666666}} \]
      8. add-sqr-sqrt73.9%

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

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
      10. clear-num73.9%

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
      11. un-div-inv73.9%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    12. Applied egg-rr73.9%

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
    14. Simplified74.0%

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

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

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

        \[\leadsto \color{blue}{\frac{b}{\frac{a}{-0.6666666666666666}}} \]
      4. div-inv74.0%

        \[\leadsto \frac{b}{\color{blue}{a \cdot \frac{1}{-0.6666666666666666}}} \]
      5. metadata-eval74.0%

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    16. Applied egg-rr74.0%

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

    if 2.2999999999999999e-308 < b

    1. Initial program 31.4%

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

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

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

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

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

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

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

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

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

Alternative 9: 67.1% accurate, 11.6× speedup?

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

    1. Initial program 71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    10. Simplified1.4%

      \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt0.8%

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

        \[\leadsto \color{blue}{\sqrt{\left(\frac{b}{a} \cdot 0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot 0.6666666666666666\right)}} \]
      3. swap-sqr28.5%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \left(0.6666666666666666 \cdot 0.6666666666666666\right)}} \]
      4. metadata-eval28.5%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{0.4444444444444444}} \]
      5. metadata-eval28.5%

        \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{\left(-0.6666666666666666 \cdot -0.6666666666666666\right)}} \]
      6. swap-sqr28.5%

        \[\leadsto \sqrt{\color{blue}{\left(\frac{b}{a} \cdot -0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot -0.6666666666666666\right)}} \]
      7. sqrt-unprod41.0%

        \[\leadsto \color{blue}{\sqrt{\frac{b}{a} \cdot -0.6666666666666666} \cdot \sqrt{\frac{b}{a} \cdot -0.6666666666666666}} \]
      8. add-sqr-sqrt73.9%

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

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
      10. clear-num73.9%

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
      11. un-div-inv73.9%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    12. Applied egg-rr73.9%

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
    14. Simplified74.0%

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

    if 6.000000000000001e-309 < b

    1. Initial program 31.4%

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

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

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

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

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

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

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

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

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

Alternative 10: 35.0% accurate, 23.2× speedup?

\[\begin{array}{l} \\ b \cdot \frac{-0.6666666666666666}{a} \end{array} \]
(FPCore (a b c) :precision binary64 (* b (/ -0.6666666666666666 a)))
double code(double a, double b, double c) {
	return b * (-0.6666666666666666 / 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 * ((-0.6666666666666666d0) / a)
end function
public static double code(double a, double b, double c) {
	return b * (-0.6666666666666666 / a);
}
def code(a, b, c):
	return b * (-0.6666666666666666 / a)
function code(a, b, c)
	return Float64(b * Float64(-0.6666666666666666 / a))
end
function tmp = code(a, b, c)
	tmp = b * (-0.6666666666666666 / a);
end
code[a_, b_, c_] := N[(b * N[(-0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
b \cdot \frac{-0.6666666666666666}{a}
\end{array}
Derivation
  1. Initial program 51.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. sqr-neg51.6%

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

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
  4. Add Preprocessing
  5. Applied egg-rr22.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{b}{a} \cdot 0.6666666666666666} \]
  11. Step-by-step derivation
    1. add-sqr-sqrt1.3%

      \[\leadsto \color{blue}{\sqrt{\frac{b}{a} \cdot 0.6666666666666666} \cdot \sqrt{\frac{b}{a} \cdot 0.6666666666666666}} \]
    2. sqrt-unprod16.1%

      \[\leadsto \color{blue}{\sqrt{\left(\frac{b}{a} \cdot 0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot 0.6666666666666666\right)}} \]
    3. swap-sqr16.1%

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

      \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{0.4444444444444444}} \]
    5. metadata-eval16.1%

      \[\leadsto \sqrt{\left(\frac{b}{a} \cdot \frac{b}{a}\right) \cdot \color{blue}{\left(-0.6666666666666666 \cdot -0.6666666666666666\right)}} \]
    6. swap-sqr16.1%

      \[\leadsto \sqrt{\color{blue}{\left(\frac{b}{a} \cdot -0.6666666666666666\right) \cdot \left(\frac{b}{a} \cdot -0.6666666666666666\right)}} \]
    7. sqrt-unprod21.8%

      \[\leadsto \color{blue}{\sqrt{\frac{b}{a} \cdot -0.6666666666666666} \cdot \sqrt{\frac{b}{a} \cdot -0.6666666666666666}} \]
    8. add-sqr-sqrt39.0%

      \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
    9. *-commutative39.0%

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
    10. clear-num39.0%

      \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
    11. un-div-inv39.0%

      \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
  12. Applied egg-rr39.0%

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

      \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
  14. Simplified39.0%

    \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
  15. Final simplification39.0%

    \[\leadsto b \cdot \frac{-0.6666666666666666}{a} \]
  16. Add Preprocessing

Reproduce

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