Cubic critical

Percentage Accurate: 51.7% → 84.2%
Time: 14.3s
Alternatives: 14
Speedup: 11.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 51.7% accurate, 1.0× speedup?

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

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

Alternative 1: 84.2% accurate, 0.9× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}\\


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

    1. Initial program 56.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    10. Step-by-step derivation
      1. clear-num93.0%

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    11. Applied egg-rr93.1%

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

    if -2.2499999999999999e45 < b < 8e-107

    1. Initial program 82.0%

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

    if 8e-107 < b

    1. Initial program 12.2%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. prod-diff12.0%

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(3 \cdot a\right) \cdot c}\right) + \mathsf{fma}\left(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      4. *-commutative12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      5. distribute-rgt-neg-in12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      6. *-commutative12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      7. distribute-rgt-neg-in12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      8. metadata-eval12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      9. *-commutative12.0%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(\left(-\color{blue}{c \cdot \left(3 \cdot a\right)}\right) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      15. distribute-rgt-neg-in12.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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      16. *-commutative12.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) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      17. distribute-rgt-neg-in12.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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      18. metadata-eval12.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) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      19. associate-*r*12.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(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      20. *-commutative12.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} \]
      21. associate-*l*12.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} \]
    6. Applied egg-rr12.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} \]
    7. Step-by-step derivation
      1. clear-num12.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{\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) + a \cdot \left(3 \cdot c\right)\right)}}}} \]
      2. inv-pow12.0%

        \[\leadsto \color{blue}{{\left(\frac{3 \cdot a}{\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) + a \cdot \left(3 \cdot c\right)\right)}}\right)}^{-1}} \]
    8. Applied egg-rr12.6%

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

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

      \[\leadsto \frac{1}{\color{blue}{b \cdot \left(1.5 \cdot \frac{a}{{b}^{2}} - 2 \cdot \frac{1}{c}\right)}} \]
    11. Step-by-step derivation
      1. associate-*r/91.7%

        \[\leadsto \frac{1}{b \cdot \left(\color{blue}{\frac{1.5 \cdot a}{{b}^{2}}} - 2 \cdot \frac{1}{c}\right)} \]
      2. *-commutative91.7%

        \[\leadsto \frac{1}{b \cdot \left(\frac{\color{blue}{a \cdot 1.5}}{{b}^{2}} - 2 \cdot \frac{1}{c}\right)} \]
      3. *-lft-identity91.7%

        \[\leadsto \frac{1}{b \cdot \left(\frac{a \cdot 1.5}{\color{blue}{1 \cdot {b}^{2}}} - 2 \cdot \frac{1}{c}\right)} \]
      4. times-frac91.7%

        \[\leadsto \frac{1}{b \cdot \left(\color{blue}{\frac{a}{1} \cdot \frac{1.5}{{b}^{2}}} - 2 \cdot \frac{1}{c}\right)} \]
      5. /-rgt-identity91.7%

        \[\leadsto \frac{1}{b \cdot \left(\color{blue}{a} \cdot \frac{1.5}{{b}^{2}} - 2 \cdot \frac{1}{c}\right)} \]
      6. associate-*r/91.7%

        \[\leadsto \frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \color{blue}{\frac{2 \cdot 1}{c}}\right)} \]
      7. metadata-eval91.7%

        \[\leadsto \frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{\color{blue}{2}}{c}\right)} \]
    12. Simplified91.7%

      \[\leadsto \frac{1}{\color{blue}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.25 \cdot 10^{+45}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 8 \cdot 10^{-107}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 84.2% accurate, 0.9× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}\\


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

    1. Initial program 56.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    10. Step-by-step derivation
      1. clear-num93.0%

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    11. Applied egg-rr93.1%

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

    if -2.2499999999999999e45 < b < 8.3999999999999997e-107

    1. Initial program 82.0%

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

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

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

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

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

    if 8.3999999999999997e-107 < b

    1. Initial program 12.2%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. prod-diff12.0%

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(3 \cdot a\right) \cdot c}\right) + \mathsf{fma}\left(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      4. *-commutative12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      5. distribute-rgt-neg-in12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      6. *-commutative12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      7. distribute-rgt-neg-in12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      8. metadata-eval12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      9. *-commutative12.0%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(\left(-\color{blue}{c \cdot \left(3 \cdot a\right)}\right) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      15. distribute-rgt-neg-in12.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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      16. *-commutative12.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) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      17. distribute-rgt-neg-in12.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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      18. metadata-eval12.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) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      19. associate-*r*12.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(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      20. *-commutative12.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} \]
      21. associate-*l*12.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} \]
    6. Applied egg-rr12.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} \]
    7. Step-by-step derivation
      1. clear-num12.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{\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) + a \cdot \left(3 \cdot c\right)\right)}}}} \]
      2. inv-pow12.0%

        \[\leadsto \color{blue}{{\left(\frac{3 \cdot a}{\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) + a \cdot \left(3 \cdot c\right)\right)}}\right)}^{-1}} \]
    8. Applied egg-rr12.6%

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

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

      \[\leadsto \frac{1}{\color{blue}{b \cdot \left(1.5 \cdot \frac{a}{{b}^{2}} - 2 \cdot \frac{1}{c}\right)}} \]
    11. Step-by-step derivation
      1. associate-*r/91.7%

        \[\leadsto \frac{1}{b \cdot \left(\color{blue}{\frac{1.5 \cdot a}{{b}^{2}}} - 2 \cdot \frac{1}{c}\right)} \]
      2. *-commutative91.7%

        \[\leadsto \frac{1}{b \cdot \left(\frac{\color{blue}{a \cdot 1.5}}{{b}^{2}} - 2 \cdot \frac{1}{c}\right)} \]
      3. *-lft-identity91.7%

        \[\leadsto \frac{1}{b \cdot \left(\frac{a \cdot 1.5}{\color{blue}{1 \cdot {b}^{2}}} - 2 \cdot \frac{1}{c}\right)} \]
      4. times-frac91.7%

        \[\leadsto \frac{1}{b \cdot \left(\color{blue}{\frac{a}{1} \cdot \frac{1.5}{{b}^{2}}} - 2 \cdot \frac{1}{c}\right)} \]
      5. /-rgt-identity91.7%

        \[\leadsto \frac{1}{b \cdot \left(\color{blue}{a} \cdot \frac{1.5}{{b}^{2}} - 2 \cdot \frac{1}{c}\right)} \]
      6. associate-*r/91.7%

        \[\leadsto \frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \color{blue}{\frac{2 \cdot 1}{c}}\right)} \]
      7. metadata-eval91.7%

        \[\leadsto \frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{\color{blue}{2}}{c}\right)} \]
    12. Simplified91.7%

      \[\leadsto \frac{1}{\color{blue}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.25 \cdot 10^{+45}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 8.4 \cdot 10^{-107}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 79.5% accurate, 0.9× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}\\


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

    1. Initial program 67.0%

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

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

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

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

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

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

    if -2.40000000000000009e-119 < b < 6.20000000000000043e-107

    1. Initial program 75.5%

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

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

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

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

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

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

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

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

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

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

    if 6.20000000000000043e-107 < b

    1. Initial program 12.2%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. prod-diff12.0%

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(3 \cdot a\right) \cdot c}\right) + \mathsf{fma}\left(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      4. *-commutative12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      5. distribute-rgt-neg-in12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      6. *-commutative12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      7. distribute-rgt-neg-in12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      8. metadata-eval12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      9. *-commutative12.0%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(\left(-\color{blue}{c \cdot \left(3 \cdot a\right)}\right) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      15. distribute-rgt-neg-in12.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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      16. *-commutative12.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) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      17. distribute-rgt-neg-in12.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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      18. metadata-eval12.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) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      19. associate-*r*12.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(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      20. *-commutative12.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} \]
      21. associate-*l*12.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} \]
    6. Applied egg-rr12.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} \]
    7. Step-by-step derivation
      1. clear-num12.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{\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) + a \cdot \left(3 \cdot c\right)\right)}}}} \]
      2. inv-pow12.0%

        \[\leadsto \color{blue}{{\left(\frac{3 \cdot a}{\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) + a \cdot \left(3 \cdot c\right)\right)}}\right)}^{-1}} \]
    8. Applied egg-rr12.6%

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

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

      \[\leadsto \frac{1}{\color{blue}{b \cdot \left(1.5 \cdot \frac{a}{{b}^{2}} - 2 \cdot \frac{1}{c}\right)}} \]
    11. Step-by-step derivation
      1. associate-*r/91.7%

        \[\leadsto \frac{1}{b \cdot \left(\color{blue}{\frac{1.5 \cdot a}{{b}^{2}}} - 2 \cdot \frac{1}{c}\right)} \]
      2. *-commutative91.7%

        \[\leadsto \frac{1}{b \cdot \left(\frac{\color{blue}{a \cdot 1.5}}{{b}^{2}} - 2 \cdot \frac{1}{c}\right)} \]
      3. *-lft-identity91.7%

        \[\leadsto \frac{1}{b \cdot \left(\frac{a \cdot 1.5}{\color{blue}{1 \cdot {b}^{2}}} - 2 \cdot \frac{1}{c}\right)} \]
      4. times-frac91.7%

        \[\leadsto \frac{1}{b \cdot \left(\color{blue}{\frac{a}{1} \cdot \frac{1.5}{{b}^{2}}} - 2 \cdot \frac{1}{c}\right)} \]
      5. /-rgt-identity91.7%

        \[\leadsto \frac{1}{b \cdot \left(\color{blue}{a} \cdot \frac{1.5}{{b}^{2}} - 2 \cdot \frac{1}{c}\right)} \]
      6. associate-*r/91.7%

        \[\leadsto \frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \color{blue}{\frac{2 \cdot 1}{c}}\right)} \]
      7. metadata-eval91.7%

        \[\leadsto \frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{\color{blue}{2}}{c}\right)} \]
    12. Simplified91.7%

      \[\leadsto \frac{1}{\color{blue}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.1%

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

Alternative 4: 79.5% accurate, 0.9× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}\\


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

    1. Initial program 67.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    11. Applied egg-rr82.1%

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

    if -2.0500000000000001e-119 < b < 8.3999999999999997e-107

    1. Initial program 75.5%

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

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

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

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

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

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

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

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

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

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

    if 8.3999999999999997e-107 < b

    1. Initial program 12.2%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. prod-diff12.0%

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(3 \cdot a\right) \cdot c}\right) + \mathsf{fma}\left(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      4. *-commutative12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      5. distribute-rgt-neg-in12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      6. *-commutative12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      7. distribute-rgt-neg-in12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      8. metadata-eval12.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      9. *-commutative12.0%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(\left(-\color{blue}{c \cdot \left(3 \cdot a\right)}\right) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      15. distribute-rgt-neg-in12.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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      16. *-commutative12.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) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      17. distribute-rgt-neg-in12.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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      18. metadata-eval12.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) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      19. associate-*r*12.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(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      20. *-commutative12.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} \]
      21. associate-*l*12.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} \]
    6. Applied egg-rr12.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} \]
    7. Step-by-step derivation
      1. clear-num12.0%

        \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{\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) + a \cdot \left(3 \cdot c\right)\right)}}}} \]
      2. inv-pow12.0%

        \[\leadsto \color{blue}{{\left(\frac{3 \cdot a}{\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) + a \cdot \left(3 \cdot c\right)\right)}}\right)}^{-1}} \]
    8. Applied egg-rr12.6%

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

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

      \[\leadsto \frac{1}{\color{blue}{b \cdot \left(1.5 \cdot \frac{a}{{b}^{2}} - 2 \cdot \frac{1}{c}\right)}} \]
    11. Step-by-step derivation
      1. associate-*r/91.7%

        \[\leadsto \frac{1}{b \cdot \left(\color{blue}{\frac{1.5 \cdot a}{{b}^{2}}} - 2 \cdot \frac{1}{c}\right)} \]
      2. *-commutative91.7%

        \[\leadsto \frac{1}{b \cdot \left(\frac{\color{blue}{a \cdot 1.5}}{{b}^{2}} - 2 \cdot \frac{1}{c}\right)} \]
      3. *-lft-identity91.7%

        \[\leadsto \frac{1}{b \cdot \left(\frac{a \cdot 1.5}{\color{blue}{1 \cdot {b}^{2}}} - 2 \cdot \frac{1}{c}\right)} \]
      4. times-frac91.7%

        \[\leadsto \frac{1}{b \cdot \left(\color{blue}{\frac{a}{1} \cdot \frac{1.5}{{b}^{2}}} - 2 \cdot \frac{1}{c}\right)} \]
      5. /-rgt-identity91.7%

        \[\leadsto \frac{1}{b \cdot \left(\color{blue}{a} \cdot \frac{1.5}{{b}^{2}} - 2 \cdot \frac{1}{c}\right)} \]
      6. associate-*r/91.7%

        \[\leadsto \frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \color{blue}{\frac{2 \cdot 1}{c}}\right)} \]
      7. metadata-eval91.7%

        \[\leadsto \frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{\color{blue}{2}}{c}\right)} \]
    12. Simplified91.7%

      \[\leadsto \frac{1}{\color{blue}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.05 \cdot 10^{-119}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 8.4 \cdot 10^{-107}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{b \cdot \left(a \cdot \frac{1.5}{{b}^{2}} - \frac{2}{c}\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 79.9% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 67.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    11. Applied egg-rr82.1%

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

    if -2.40000000000000009e-119 < b < 6.20000000000000043e-107

    1. Initial program 75.5%

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

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

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

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

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

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

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

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

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

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

    if 6.20000000000000043e-107 < b

    1. Initial program 12.2%

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

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

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

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

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

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

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

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

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

Alternative 6: 79.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 67.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    11. Applied egg-rr82.1%

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

    if -2.40000000000000009e-119 < b < 7.19999999999999953e-107

    1. Initial program 75.5%

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

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

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

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

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

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

    if 7.19999999999999953e-107 < b

    1. Initial program 12.2%

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

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

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

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

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

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

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

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

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

Alternative 7: 79.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 67.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    11. Applied egg-rr82.1%

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

    if -4.40000000000000042e-121 < b < 5.1000000000000002e-107

    1. Initial program 75.5%

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(3 \cdot a\right) \cdot c}\right) + \mathsf{fma}\left(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      4. *-commutative75.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      5. distribute-rgt-neg-in75.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      6. *-commutative75.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      7. distribute-rgt-neg-in75.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      8. metadata-eval75.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      9. *-commutative75.1%

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(\left(-\color{blue}{c \cdot \left(3 \cdot a\right)}\right) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      15. distribute-rgt-neg-in75.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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      16. *-commutative75.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) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      17. distribute-rgt-neg-in75.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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      18. metadata-eval75.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) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      19. associate-*r*75.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(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      20. *-commutative75.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} \]
      21. associate-*l*75.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} \]
    6. Applied egg-rr75.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} \]
    7. Taylor expanded in b around 0 74.8%

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

        \[\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/74.8%

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

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

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

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

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

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

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

        \[\leadsto \frac{0.3333333333333333}{a} \cdot \sqrt{a \cdot \left(c \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}\right)} \]
      10. rem-square-sqrt75.2%

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

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

    if 5.1000000000000002e-107 < b

    1. Initial program 12.2%

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

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

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

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

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

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

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

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

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

Alternative 8: 71.2% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 2.7 \cdot 10^{-197}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt{-3 \cdot \frac{c}{a}}\\

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


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

    1. Initial program 67.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
    11. Applied egg-rr82.1%

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

    if -2.05000000000000005e-135 < b < 2.70000000000000017e-197

    1. Initial program 81.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(3 \cdot a\right) \cdot c}\right) + \mathsf{fma}\left(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      4. *-commutative81.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      5. distribute-rgt-neg-in81.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      6. *-commutative81.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      7. distribute-rgt-neg-in81.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      8. metadata-eval81.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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      9. *-commutative81.0%

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

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

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

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

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

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

        \[\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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      16. *-commutative80.9%

        \[\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) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      17. distribute-rgt-neg-in80.9%

        \[\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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      18. metadata-eval80.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 \color{blue}{-3}\right) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      19. associate-*r*81.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(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      20. *-commutative81.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} \]
      21. associate-*l*80.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} \]
    6. Applied egg-rr80.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} \]
    7. Taylor expanded in a around inf 36.0%

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\frac{c \cdot -3}{a}} \cdot 0.3333333333333333} \]
    10. Taylor expanded in c around 0 36.1%

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

    if 2.70000000000000017e-197 < b

    1. Initial program 22.4%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.05 \cdot 10^{-135}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 2.7 \cdot 10^{-197}:\\ \;\;\;\;0.3333333333333333 \cdot \sqrt{-3 \cdot \frac{c}{a}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 71.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 67.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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}} \]
    11. Applied egg-rr81.5%

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

    if -3.0000000000000002e-149 < b < 3.4000000000000003e-200

    1. Initial program 80.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\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(-a \cdot c, 3, \left(a \cdot c\right) \cdot 3\right)}}{3 \cdot a} \]
      8. metadata-eval80.3%

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right) + \left(\left(-\color{blue}{c \cdot \left(3 \cdot a\right)}\right) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      15. distribute-rgt-neg-in80.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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      16. *-commutative80.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) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      17. distribute-rgt-neg-in80.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)} + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      18. metadata-eval80.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) + 3 \cdot \left(a \cdot c\right)\right)}}{3 \cdot a} \]
      19. associate-*r*80.4%

        \[\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(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      20. *-commutative80.4%

        \[\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} \]
      21. associate-*l*80.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}{a \cdot \left(3 \cdot c\right)}\right)}}{3 \cdot a} \]
    6. Applied egg-rr80.2%

      \[\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} \]
    7. Taylor expanded in a around inf 36.9%

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

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

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

        \[\leadsto \sqrt{\frac{c \cdot \color{blue}{-3}}{a}} \cdot 0.3333333333333333 \]
    9. Simplified36.9%

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

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

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

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

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

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

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

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

    if 3.4000000000000003e-200 < b

    1. Initial program 22.4%

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

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

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

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

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

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

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

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

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

Alternative 10: 67.1% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 69.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-2neg69.8%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    10. Step-by-step derivation
      1. clear-num71.8%

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 28.1%

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

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

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

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

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

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

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

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

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

Alternative 11: 67.1% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 69.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-2neg69.8%

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 28.1%

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

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

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

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

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

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

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

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

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

Alternative 12: 67.0% accurate, 11.6× speedup?

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

    1. Initial program 69.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-2neg69.8%

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

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

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

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

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

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

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

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

    if 1.9999999999999988e-309 < b

    1. Initial program 28.1%

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

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

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

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

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

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

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

Alternative 13: 41.3% accurate, 11.6× speedup?

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

    1. Initial program 60.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-2neg60.8%

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

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

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

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

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

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

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

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

    if 3e96 < b

    1. Initial program 9.9%

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

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

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

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

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

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

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

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

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

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

Alternative 14: 10.9% accurate, 23.2× speedup?

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. clear-num50.2%

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

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

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

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

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

Reproduce

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