Cubic critical

Percentage Accurate: 51.0% → 86.8%
Time: 16.1s
Alternatives: 15
Speedup: 16.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 51.0% accurate, 1.0× speedup?

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

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

Alternative 1: 86.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_0 := c \cdot \left(-3 \cdot \left(a + a\right)\right)\\
\mathbf{if}\;b \leq -2.4 \cdot 10^{+148}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\

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

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

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


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

    1. Initial program 42.2%

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

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

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

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

    if -2.39999999999999995e148 < b < 1.21999999999999996e-126

    1. Initial program 84.0%

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

    if 1.21999999999999996e-126 < b < 9.00000000000000039e119

    1. Initial program 32.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.00000000000000039e119 < b

    1. Initial program 7.4%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    4. Applied egg-rr98.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.4 \cdot 10^{+148}:\\ \;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 1.22 \cdot 10^{-126}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 9 \cdot 10^{+119}:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{\frac{\left(b \cdot b - b \cdot b\right) + \left(\left(a \cdot c\right) \cdot -3 - c \cdot \left(-3 \cdot \left(a + a\right)\right)\right)}{b + \sqrt{b \cdot b + \left(c \cdot \left(-3 \cdot \left(a + a\right)\right) - a \cdot \left(c \cdot -3\right)\right)}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 2: 85.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 51.4%

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

      \[\leadsto \frac{\color{blue}{1.5 \cdot \frac{c \cdot a}{b} + -2 \cdot b}}{3 \cdot a} \]
    3. Step-by-step derivation
      1. +-commutative97.8%

        \[\leadsto \frac{\color{blue}{-2 \cdot b + 1.5 \cdot \frac{c \cdot a}{b}}}{3 \cdot a} \]
      2. *-commutative97.8%

        \[\leadsto \frac{\color{blue}{b \cdot -2} + 1.5 \cdot \frac{c \cdot a}{b}}{3 \cdot a} \]
      3. fma-def97.8%

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

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

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

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

    if -2.9999999999999999e130 < b < 3.00000000000000018e-118

    1. Initial program 81.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.00000000000000018e-118 < b

    1. Initial program 17.9%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    4. Applied egg-rr86.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{+130}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{c}{\frac{b}{a}} \cdot 1.5\right)}{a \cdot 3}\\ \mathbf{elif}\;b \leq 3 \cdot 10^{-118}:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{b - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 3: 85.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.8 \cdot 10^{+148}:\\ \;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{-117}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \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 -1.8e+148)
   (+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
   (if (<= b 1.5e-117)
     (/ (- (sqrt (- (* b b) (* (* a c) 3.0))) b) (* a 3.0))
     (/ (* c -0.5) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.8e+148) {
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
	} else if (b <= 1.5e-117) {
		tmp = (sqrt(((b * b) - ((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 <= (-1.8d+148)) then
        tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
    else if (b <= 1.5d-117) then
        tmp = (sqrt(((b * b) - ((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 <= -1.8e+148) {
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
	} else if (b <= 1.5e-117) {
		tmp = (Math.sqrt(((b * b) - ((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 <= -1.8e+148:
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b))
	elif b <= 1.5e-117:
		tmp = (math.sqrt(((b * b) - ((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 <= -1.8e+148)
		tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b)));
	elseif (b <= 1.5e-117)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - 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 <= -1.8e+148)
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
	elseif (b <= 1.5e-117)
		tmp = (sqrt(((b * b) - ((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, -1.8e+148], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.5e-117], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * c), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 1.5 \cdot 10^{-117}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \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 < -1.80000000000000003e148

    1. Initial program 42.2%

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

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

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

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

    if -1.80000000000000003e148 < b < 1.49999999999999996e-117

    1. Initial program 82.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.49999999999999996e-117 < b

    1. Initial program 17.9%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    4. Applied egg-rr86.5%

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

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

Alternative 4: 85.5% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 42.2%

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

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

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

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

    if -2.24999999999999997e148 < b < 1.49999999999999996e-117

    1. Initial program 82.8%

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

    if 1.49999999999999996e-117 < b

    1. Initial program 17.9%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    4. Applied egg-rr86.5%

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

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

Alternative 5: 81.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 72.9%

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

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

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

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

    if -4.99999999999999977e-58 < b < 7.6000000000000002e-118

    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. /-rgt-identity71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.6000000000000002e-118 < b

    1. Initial program 17.9%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    4. Applied egg-rr86.5%

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

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

Alternative 6: 81.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -4.9 \cdot 10^{-60}:\\ \;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \leq 1.3 \cdot 10^{-117}:\\ \;\;\;\;\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 -4.9e-60)
   (+ (/ (* b -0.6666666666666666) a) (* 0.5 (/ c b)))
   (if (<= b 1.3e-117)
     (/ (- (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 <= -4.9e-60) {
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
	} else if (b <= 1.3e-117) {
		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 <= (-4.9d-60)) then
        tmp = ((b * (-0.6666666666666666d0)) / a) + (0.5d0 * (c / b))
    else if (b <= 1.3d-117) 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 <= -4.9e-60) {
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
	} else if (b <= 1.3e-117) {
		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 <= -4.9e-60:
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b))
	elif b <= 1.3e-117:
		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 <= -4.9e-60)
		tmp = Float64(Float64(Float64(b * -0.6666666666666666) / a) + Float64(0.5 * Float64(c / b)));
	elseif (b <= 1.3e-117)
		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 <= -4.9e-60)
		tmp = ((b * -0.6666666666666666) / a) + (0.5 * (c / b));
	elseif (b <= 1.3e-117)
		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, -4.9e-60], N[(N[(N[(b * -0.6666666666666666), $MachinePrecision] / a), $MachinePrecision] + N[(0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.3e-117], 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 -4.9 \cdot 10^{-60}:\\
\;\;\;\;\frac{b \cdot -0.6666666666666666}{a} + 0.5 \cdot \frac{c}{b}\\

\mathbf{elif}\;b \leq 1.3 \cdot 10^{-117}:\\
\;\;\;\;\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 < -4.89999999999999988e-60

    1. Initial program 72.9%

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

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

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

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

    if -4.89999999999999988e-60 < b < 1.29999999999999992e-117

    1. Initial program 71.1%

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

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

    if 1.29999999999999992e-117 < b

    1. Initial program 17.9%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    4. Applied egg-rr86.5%

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

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

Alternative 7: 81.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{-59}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{c}{\frac{b}{a}} \cdot 1.5\right)}{a \cdot 3}\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{-117}:\\ \;\;\;\;\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 -3e-59)
   (/ (fma b -2.0 (* (/ c (/ b a)) 1.5)) (* a 3.0))
   (if (<= b 1.5e-117)
     (/ (- (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 <= -3e-59) {
		tmp = fma(b, -2.0, ((c / (b / a)) * 1.5)) / (a * 3.0);
	} else if (b <= 1.5e-117) {
		tmp = (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 <= -3e-59)
		tmp = Float64(fma(b, -2.0, Float64(Float64(c / Float64(b / a)) * 1.5)) / Float64(a * 3.0));
	elseif (b <= 1.5e-117)
		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
code[a_, b_, c_] := If[LessEqual[b, -3e-59], N[(N[(b * -2.0 + N[(N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.5e-117], 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 \cdot 10^{-59}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{c}{\frac{b}{a}} \cdot 1.5\right)}{a \cdot 3}\\

\mathbf{elif}\;b \leq 1.5 \cdot 10^{-117}:\\
\;\;\;\;\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.0000000000000001e-59

    1. Initial program 72.9%

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

      \[\leadsto \frac{\color{blue}{1.5 \cdot \frac{c \cdot a}{b} + -2 \cdot b}}{3 \cdot a} \]
    3. Step-by-step derivation
      1. +-commutative90.0%

        \[\leadsto \frac{\color{blue}{-2 \cdot b + 1.5 \cdot \frac{c \cdot a}{b}}}{3 \cdot a} \]
      2. *-commutative90.0%

        \[\leadsto \frac{\color{blue}{b \cdot -2} + 1.5 \cdot \frac{c \cdot a}{b}}{3 \cdot a} \]
      3. fma-def90.0%

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

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

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

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

    if -3.0000000000000001e-59 < b < 1.49999999999999996e-117

    1. Initial program 71.1%

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

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

    if 1.49999999999999996e-117 < b

    1. Initial program 17.9%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    4. Applied egg-rr86.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{-59}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, -2, \frac{c}{\frac{b}{a}} \cdot 1.5\right)}{a \cdot 3}\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{-117}:\\ \;\;\;\;\frac{\sqrt{\left(a \cdot c\right) \cdot -3} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \end{array} \]

Alternative 8: 80.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 72.9%

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

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

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

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

    if -4.89999999999999988e-60 < b < 3.90000000000000001e-118

    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. /-rgt-identity71.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.3333333333333333 \cdot \frac{\color{blue}{-\sqrt{-6 \cdot \left(c \cdot a\right) - -3 \cdot \left(c \cdot a\right)}}}{a} \]
      2. distribute-rgt-out--65.0%

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

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

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

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

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

    if 3.90000000000000001e-118 < b

    1. Initial program 17.9%

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} \]
    4. Applied egg-rr86.5%

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

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

Alternative 9: 68.4% accurate, 8.9× speedup?

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

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

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


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

    1. Initial program 70.5%

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

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

    if -9.999999999999969e-311 < b

    1. Initial program 32.2%

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

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

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

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

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

Alternative 10: 68.4% accurate, 8.9× speedup?

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

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

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


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

    1. Initial program 70.5%

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

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

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

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

    if -9.999999999999969e-311 < b

    1. Initial program 32.2%

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

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

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

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

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

Alternative 11: 68.3% accurate, 12.8× speedup?

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

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

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


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

    1. Initial program 70.8%

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

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

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

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

    if 1.1e-301 < b

    1. Initial program 31.7%

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

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

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

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

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

Alternative 12: 68.2% accurate, 16.4× speedup?

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

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

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


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

    1. Initial program 70.8%

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

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

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

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

    if 1.19999999999999996e-301 < b

    1. Initial program 31.7%

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

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

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

Alternative 13: 68.2% accurate, 16.4× speedup?

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

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

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


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

    1. Initial program 70.8%

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

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

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

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

    if 1.1500000000000001e-301 < b

    1. Initial program 31.7%

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

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

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

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

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

Alternative 14: 68.3% accurate, 16.4× speedup?

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

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

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


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

    1. Initial program 70.8%

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

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

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

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

        \[\leadsto \color{blue}{\frac{b \cdot -0.6666666666666666}{a}} \]
    6. Applied egg-rr69.1%

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

    if 1.57999999999999995e-301 < b

    1. Initial program 31.7%

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

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

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

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

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

Alternative 15: 35.5% accurate, 23.2× speedup?

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

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

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

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

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

Reproduce

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