Cubic critical

Percentage Accurate: 52.6% → 85.8%
Time: 24.3s
Alternatives: 13
Speedup: 11.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 52.6% accurate, 1.0× speedup?

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

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

Alternative 1: 85.8% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;b \leq 6.5 \cdot 10^{-108}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)} - b}{a \cdot 3}\\

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


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

    1. Initial program 38.0%

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv38.0%

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}}{3 \cdot a} \]
    6. Taylor expanded in b around -inf 90.3%

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

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

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

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

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

    if -3.05e119 < b < 6.5000000000000002e-108

    1. Initial program 78.9%

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv78.8%

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

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

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

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

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

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

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

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

    if 6.5000000000000002e-108 < b

    1. Initial program 16.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.05 \cdot 10^{+119}:\\ \;\;\;\;b \cdot \frac{-0.6666666666666666}{a}\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{-108}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 85.8% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 38.0%

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv38.0%

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}}{3 \cdot a} \]
    6. Taylor expanded in b around -inf 90.3%

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

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

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

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

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

    if -2.80000000000000013e119 < b < 6.20000000000000028e-108

    1. Initial program 78.9%

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

    if 6.20000000000000028e-108 < b

    1. Initial program 16.8%

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

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

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

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

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

Alternative 3: 79.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 69.3%

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv69.3%

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}}{3 \cdot a} \]
    6. Taylor expanded in b around -inf 77.8%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr77.9%

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

    if -1.34999999999999991e-155 < b < 5.50000000000000031e-108

    1. Initial program 65.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}}{3 \cdot a} \]
    6. Taylor expanded in c around inf 65.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.50000000000000031e-108 < b

    1. Initial program 16.8%

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

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

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

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

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

Alternative 4: 80.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 68.8%

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv68.8%

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}}{3 \cdot a} \]
    6. Taylor expanded in b around -inf 81.3%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr81.5%

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

    if -1.42e-99 < b < 1.19999999999999994e-109

    1. Initial program 66.9%

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

        \[\leadsto \frac{\left(-b\right) + \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)}}}{3 \cdot a} \]
      2. distribute-rgt-neg-in66.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \left(a \cdot -3\right) + a \cdot \left(3 \cdot c\right)\right)}}}{3 \cdot a} \]
    5. Taylor expanded in b around 0 62.4%

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

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

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

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

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

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

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

    if 1.19999999999999994e-109 < b

    1. Initial program 16.8%

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

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

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

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

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

Alternative 5: 80.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 68.8%

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv68.8%

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}}{3 \cdot a} \]
    6. Taylor expanded in b around -inf 81.3%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr81.5%

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

    if -4.39999999999999978e-100 < b < 1.25000000000000005e-109

    1. Initial program 66.9%

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

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

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

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

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

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

    if 1.25000000000000005e-109 < b

    1. Initial program 16.8%

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

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

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

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

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

Alternative 6: 79.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 69.3%

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv69.3%

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}}{3 \cdot a} \]
    6. Taylor expanded in b around -inf 77.8%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr77.9%

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

    if -1.25e-155 < b < 6.80000000000000004e-108

    1. Initial program 65.8%

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

        \[\leadsto \frac{\left(-b\right) + \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)}}}{3 \cdot a} \]
      2. distribute-rgt-neg-in65.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(c \cdot \left(a \cdot -3\right) + a \cdot \left(3 \cdot c\right)\right)}}}{3 \cdot a} \]
    5. Taylor expanded in b around 0 64.2%

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

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

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

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

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

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

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

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

    if 6.80000000000000004e-108 < b

    1. Initial program 16.8%

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

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

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

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

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

Alternative 7: 72.4% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 9.5 \cdot 10^{-133}:\\
\;\;\;\;\sqrt{c \cdot \frac{-0.3333333333333333}{a}}\\

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


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

    1. Initial program 68.8%

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv68.8%

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}}{3 \cdot a} \]
    6. Taylor expanded in b around -inf 81.3%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr81.5%

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

    if -3.70000000000000016e-110 < b < 9.4999999999999992e-133

    1. Initial program 66.8%

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

        \[\leadsto \frac{\left(-b\right) + \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)}}}{3 \cdot a} \]
      2. distribute-rgt-neg-in66.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \sqrt{\frac{-6 \cdot c + 3 \cdot c}{a}}} \]
    6. Step-by-step derivation
      1. *-commutative38.0%

        \[\leadsto \color{blue}{\sqrt{\frac{-6 \cdot c + 3 \cdot c}{a}} \cdot 0.3333333333333333} \]
      2. distribute-rgt-out38.0%

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

        \[\leadsto \sqrt{\frac{c \cdot \color{blue}{-3}}{a}} \cdot 0.3333333333333333 \]
    7. Simplified38.0%

      \[\leadsto \color{blue}{\sqrt{\frac{c \cdot -3}{a}} \cdot 0.3333333333333333} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt37.9%

        \[\leadsto \color{blue}{\sqrt{\sqrt{\frac{c \cdot -3}{a}} \cdot 0.3333333333333333} \cdot \sqrt{\sqrt{\frac{c \cdot -3}{a}} \cdot 0.3333333333333333}} \]
      2. sqrt-unprod38.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\left(c \cdot \frac{-3}{a}\right) \cdot 0.1111111111111111}} \]
    10. Step-by-step derivation
      1. associate-*l*38.1%

        \[\leadsto \sqrt{\color{blue}{c \cdot \left(\frac{-3}{a} \cdot 0.1111111111111111\right)}} \]
      2. associate-*l/38.2%

        \[\leadsto \sqrt{c \cdot \color{blue}{\frac{-3 \cdot 0.1111111111111111}{a}}} \]
      3. metadata-eval38.2%

        \[\leadsto \sqrt{c \cdot \frac{\color{blue}{-0.3333333333333333}}{a}} \]
    11. Simplified38.2%

      \[\leadsto \color{blue}{\sqrt{c \cdot \frac{-0.3333333333333333}{a}}} \]

    if 9.4999999999999992e-133 < b

    1. Initial program 19.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.7 \cdot 10^{-110}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 9.5 \cdot 10^{-133}:\\ \;\;\;\;\sqrt{c \cdot \frac{-0.3333333333333333}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -0.5\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 68.5% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 67.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}}{3 \cdot a} \]
    6. Taylor expanded in b around -inf 63.7%

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

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

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

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

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

    if 2.40000000000000008e-308 < b

    1. Initial program 29.0%

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

      \[\leadsto \color{blue}{c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - 0.5 \cdot \frac{1}{b}\right)} \]
    4. Step-by-step derivation
      1. associate-*r/66.0%

        \[\leadsto c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - \color{blue}{\frac{0.5 \cdot 1}{b}}\right) \]
      2. metadata-eval66.0%

        \[\leadsto c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - \frac{\color{blue}{0.5}}{b}\right) \]
    5. Simplified66.0%

      \[\leadsto \color{blue}{c \cdot \left(-0.375 \cdot \frac{a \cdot c}{{b}^{3}} - \frac{0.5}{b}\right)} \]
    6. Taylor expanded in c around 0 72.3%

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

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

        \[\leadsto \color{blue}{\frac{-0.5}{b} \cdot c} \]
      3. *-commutative72.1%

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

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

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

Alternative 9: 68.6% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 67.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}}{3 \cdot a} \]
    6. Taylor expanded in b around -inf 63.7%

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

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

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

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

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

    if 2.40000000000000008e-308 < b

    1. Initial program 29.0%

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

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

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

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

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

Alternative 10: 68.6% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 67.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}}{3 \cdot a} \]
    6. Taylor expanded in b around -inf 63.7%

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    9. Taylor expanded in b around 0 63.7%

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{1}{-1.5}}}{a} \cdot b \]
      4. associate-/r*63.7%

        \[\leadsto \color{blue}{\frac{1}{-1.5 \cdot a}} \cdot b \]
      5. *-commutative63.7%

        \[\leadsto \frac{1}{\color{blue}{a \cdot -1.5}} \cdot b \]
      6. associate-/r/63.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot -1.5}{b}}} \]
      7. associate-*l/63.7%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} \cdot -1.5}} \]
      8. *-commutative63.7%

        \[\leadsto \frac{1}{\color{blue}{-1.5 \cdot \frac{a}{b}}} \]
      9. associate-/r*63.8%

        \[\leadsto \color{blue}{\frac{\frac{1}{-1.5}}{\frac{a}{b}}} \]
      10. metadata-eval63.8%

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

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

    if 2.40000000000000008e-308 < b

    1. Initial program 29.0%

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

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

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

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

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

Alternative 11: 68.7% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 67.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}}{3 \cdot a} \]
    6. Taylor expanded in b around -inf 63.7%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    10. Applied egg-rr63.8%

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

    if 2.40000000000000008e-308 < b

    1. Initial program 29.0%

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

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

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

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

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

Alternative 12: 2.5% accurate, 23.2× speedup?

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

\\
1.3333333333333333 \cdot \frac{b}{a}
\end{array}
Derivation
  1. Initial program 46.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. Simplified46.7%

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{3 \cdot a}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity46.7%

        \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}} - b}{3 \cdot a} \]
      2. *-un-lft-identity46.7%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{1.3333333333333333 \cdot \frac{b}{a}} \]
    8. Final simplification2.4%

      \[\leadsto 1.3333333333333333 \cdot \frac{b}{a} \]
    9. Add Preprocessing

    Alternative 13: 36.3% accurate, 23.2× speedup?

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv46.8%

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c, a \cdot -3, {b}^{2}\right)}}}{3 \cdot a} \]
    6. Taylor expanded in b around -inf 30.8%

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

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

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

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

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

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

    Reproduce

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