Cubic critical

Percentage Accurate: 52.9% → 83.8%
Time: 18.5s
Alternatives: 15
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 15 alternatives:

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

Initial Program: 52.9% 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: 83.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.2 \cdot 10^{+159}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 1.45 \cdot 10^{-102}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 1.25 \cdot 10^{-38} \lor \neg \left(b \leq 5100000\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + \mathsf{hypot}\left(b, \sqrt{a \cdot -3} \cdot \sqrt{c}\right)}{a \cdot 3}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.2e+159)
   (/ b (* a -1.5))
   (if (<= b 1.45e-102)
     (/ (- (sqrt (- (* b b) (* (* a 3.0) c))) b) (* a 3.0))
     (if (or (<= b 1.25e-38) (not (<= b 5100000.0)))
       (/ (* c -0.5) b)
       (/ (+ b (hypot b (* (sqrt (* a -3.0)) (sqrt c)))) (* a 3.0))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.2e+159) {
		tmp = b / (a * -1.5);
	} else if (b <= 1.45e-102) {
		tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
	} else if ((b <= 1.25e-38) || !(b <= 5100000.0)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = (b + hypot(b, (sqrt((a * -3.0)) * sqrt(c)))) / (a * 3.0);
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.2e+159) {
		tmp = b / (a * -1.5);
	} else if (b <= 1.45e-102) {
		tmp = (Math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
	} else if ((b <= 1.25e-38) || !(b <= 5100000.0)) {
		tmp = (c * -0.5) / b;
	} else {
		tmp = (b + Math.hypot(b, (Math.sqrt((a * -3.0)) * Math.sqrt(c)))) / (a * 3.0);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.2e+159:
		tmp = b / (a * -1.5)
	elif b <= 1.45e-102:
		tmp = (math.sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0)
	elif (b <= 1.25e-38) or not (b <= 5100000.0):
		tmp = (c * -0.5) / b
	else:
		tmp = (b + math.hypot(b, (math.sqrt((a * -3.0)) * math.sqrt(c)))) / (a * 3.0)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.2e+159)
		tmp = Float64(b / Float64(a * -1.5));
	elseif (b <= 1.45e-102)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 3.0) * c))) - b) / Float64(a * 3.0));
	elseif ((b <= 1.25e-38) || !(b <= 5100000.0))
		tmp = Float64(Float64(c * -0.5) / b);
	else
		tmp = Float64(Float64(b + hypot(b, Float64(sqrt(Float64(a * -3.0)) * sqrt(c)))) / Float64(a * 3.0));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.2e+159)
		tmp = b / (a * -1.5);
	elseif (b <= 1.45e-102)
		tmp = (sqrt(((b * b) - ((a * 3.0) * c))) - b) / (a * 3.0);
	elseif ((b <= 1.25e-38) || ~((b <= 5100000.0)))
		tmp = (c * -0.5) / b;
	else
		tmp = (b + hypot(b, (sqrt((a * -3.0)) * sqrt(c)))) / (a * 3.0);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.2e+159], N[(b / N[(a * -1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.45e-102], 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], If[Or[LessEqual[b, 1.25e-38], N[Not[LessEqual[b, 5100000.0]], $MachinePrecision]], N[(N[(c * -0.5), $MachinePrecision] / b), $MachinePrecision], N[(N[(b + N[Sqrt[b ^ 2 + N[(N[Sqrt[N[(a * -3.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[c], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;b \leq 1.25 \cdot 10^{-38} \lor \neg \left(b \leq 5100000\right):\\
\;\;\;\;\frac{c \cdot -0.5}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{b + \mathsf{hypot}\left(b, \sqrt{a \cdot -3} \cdot \sqrt{c}\right)}{a \cdot 3}\\


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

    1. Initial program 56.7%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} - b \cdot \frac{0.3333333333333333}{a}} \]
      2. distribute-rgt-out--51.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a} \cdot \color{blue}{\frac{1}{-1.5}} \]
      3. times-frac99.9%

        \[\leadsto \color{blue}{\frac{b \cdot 1}{a \cdot -1.5}} \]
      4. *-rgt-identity99.9%

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

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

    if -1.2e159 < b < 1.44999999999999993e-102

    1. Initial program 83.3%

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

    if 1.44999999999999993e-102 < b < 1.25000000000000008e-38 or 5.1e6 < b

    1. Initial program 13.7%

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

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

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

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

    if 1.25000000000000008e-38 < b < 5.1e6

    1. Initial program 39.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. +-commutative39.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot \color{blue}{-3}\right)}\right) + \left(-b\right)}{3 \cdot a} \]
      15. add-sqr-sqrt0.0%

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

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

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

        \[\leadsto \frac{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right) + \color{blue}{\sqrt{b} \cdot \sqrt{b}}}{3 \cdot a} \]
      19. add-sqr-sqrt39.2%

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

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

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

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

      \[\leadsto \frac{\mathsf{hypot}\left(b, \color{blue}{\sqrt{a \cdot -3} \cdot \sqrt{c}}\right) + b}{3 \cdot a} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification87.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.2 \cdot 10^{+159}:\\ \;\;\;\;\frac{b}{a \cdot -1.5}\\ \mathbf{elif}\;b \leq 1.45 \cdot 10^{-102}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\ \mathbf{elif}\;b \leq 1.25 \cdot 10^{-38} \lor \neg \left(b \leq 5100000\right):\\ \;\;\;\;\frac{c \cdot -0.5}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + \mathsf{hypot}\left(b, \sqrt{a \cdot -3} \cdot \sqrt{c}\right)}{a \cdot 3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 85.2% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 56.7%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} - b \cdot \frac{0.3333333333333333}{a}} \]
      2. distribute-rgt-out--51.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a} \cdot \color{blue}{\frac{1}{-1.5}} \]
      3. times-frac99.9%

        \[\leadsto \color{blue}{\frac{b \cdot 1}{a \cdot -1.5}} \]
      4. *-rgt-identity99.9%

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

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

    if -1.2e159 < b < 1.9500000000000001e-103

    1. Initial program 83.3%

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

    if 1.9500000000000001e-103 < b

    1. Initial program 15.6%

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

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

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

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

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

Alternative 3: 80.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.02 \cdot 10^{-47}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\

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

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


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

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

    if -1.02000000000000002e-47 < b < 3.40000000000000013e-102

    1. Initial program 75.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{a} \cdot \left(\mathsf{fma}\left(\sqrt{a}, \sqrt{c \cdot -3}, b\right) \cdot 0.3333333333333333\right)\right)} - 1} \]
      3. associate-*r*22.4%

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

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{0.3333333333333333 \cdot \left(\frac{1}{a} \cdot \mathsf{fma}\left(\sqrt{a}, \sqrt{c \cdot -3}, b\right)\right)}\right)} - 1 \]
      5. associate-*l/22.4%

        \[\leadsto e^{\mathsf{log1p}\left(0.3333333333333333 \cdot \color{blue}{\frac{1 \cdot \mathsf{fma}\left(\sqrt{a}, \sqrt{c \cdot -3}, b\right)}{a}}\right)} - 1 \]
      6. *-un-lft-identity22.4%

        \[\leadsto e^{\mathsf{log1p}\left(0.3333333333333333 \cdot \frac{\color{blue}{\mathsf{fma}\left(\sqrt{a}, \sqrt{c \cdot -3}, b\right)}}{a}\right)} - 1 \]
      7. fma-udef22.4%

        \[\leadsto e^{\mathsf{log1p}\left(0.3333333333333333 \cdot \frac{\color{blue}{\sqrt{a} \cdot \sqrt{c \cdot -3} + b}}{a}\right)} - 1 \]
      8. +-commutative22.4%

        \[\leadsto e^{\mathsf{log1p}\left(0.3333333333333333 \cdot \frac{\color{blue}{b + \sqrt{a} \cdot \sqrt{c \cdot -3}}}{a}\right)} - 1 \]
      9. sqrt-unprod16.2%

        \[\leadsto e^{\mathsf{log1p}\left(0.3333333333333333 \cdot \frac{b + \color{blue}{\sqrt{a \cdot \left(c \cdot -3\right)}}}{a}\right)} - 1 \]
    9. Applied egg-rr16.2%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(0.3333333333333333 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{a}\right)} - 1} \]
    10. Step-by-step derivation
      1. expm1-def43.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(0.3333333333333333 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -3\right)}}{a}\right)\right)} \]
      2. expm1-log1p68.9%

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

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

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

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

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

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

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

    if 3.40000000000000013e-102 < b

    1. Initial program 15.6%

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

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

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

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

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

Alternative 4: 80.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.5 \cdot 10^{-48}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\

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

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


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

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

    if -4.49999999999999988e-48 < b < 8.30000000000000006e-103

    1. Initial program 75.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{a} \cdot \sqrt{c \cdot -3} + b}}{\frac{a}{0.3333333333333333}} \]
      5. +-commutative46.2%

        \[\leadsto \frac{\color{blue}{b + \sqrt{a} \cdot \sqrt{c \cdot -3}}}{\frac{a}{0.3333333333333333}} \]
      6. sqrt-unprod68.9%

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

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

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

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

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

    if 8.30000000000000006e-103 < b

    1. Initial program 15.6%

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

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

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

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

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

Alternative 5: 80.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -6 \cdot 10^{-47}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\

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

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


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

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

    if -6.00000000000000033e-47 < b < 2.9500000000000001e-102

    1. Initial program 75.5%

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

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

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

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

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

    if 2.9500000000000001e-102 < b

    1. Initial program 15.6%

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

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

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

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

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

Alternative 6: 80.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.8 \cdot 10^{-48}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\

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

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


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

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

    if -8.8000000000000005e-48 < b < 1.35000000000000005e-103

    1. Initial program 75.5%

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

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

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

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

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

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

    if 1.35000000000000005e-103 < b

    1. Initial program 15.6%

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

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

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

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

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

Alternative 7: 67.4% accurate, 5.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(\frac{a \cdot 1.5}{\frac{b}{c}} - b\right) - b}{a \cdot 3}\\

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


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

    1. Initial program 81.4%

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 27.2%

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

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

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

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

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

Alternative 8: 67.4% accurate, 7.2× speedup?

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

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

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


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

    1. Initial program 81.4%

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 27.2%

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

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

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

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

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

Alternative 9: 43.4% accurate, 11.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 2.9e19

    1. Initial program 72.4%

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

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

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

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

    if 2.9e19 < b

    1. Initial program 6.5%

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    4. Taylor expanded in b around 0 24.1%

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{b}{c}}} \]
      3. associate-/r/24.1%

        \[\leadsto \color{blue}{\frac{0.5}{b} \cdot c} \]
    6. Simplified24.1%

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

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

Alternative 10: 43.4% accurate, 11.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 8e21

    1. Initial program 72.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    7. Applied egg-rr42.6%

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

    if 8e21 < b

    1. Initial program 6.5%

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
    4. Taylor expanded in b around 0 24.1%

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

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

        \[\leadsto \color{blue}{\frac{0.5}{\frac{b}{c}}} \]
      3. associate-/r/24.1%

        \[\leadsto \color{blue}{\frac{0.5}{b} \cdot c} \]
    6. Simplified24.1%

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

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

Alternative 11: 66.9% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 80.1%

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

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

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

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

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

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

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

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

    if 5.2000000000000001e-281 < b

    1. Initial program 27.5%

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5}{\frac{b}{c}}} \]
    5. Simplified64.9%

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

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

Alternative 12: 66.9% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 80.1%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} - b \cdot \frac{0.3333333333333333}{a}} \]
      2. distribute-rgt-out--66.6%

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a} \cdot \color{blue}{\frac{1}{-1.5}} \]
      3. times-frac62.4%

        \[\leadsto \color{blue}{\frac{b \cdot 1}{a \cdot -1.5}} \]
      4. *-rgt-identity62.4%

        \[\leadsto \frac{\color{blue}{b}}{a \cdot -1.5} \]
    10. Simplified62.4%

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

    if 5.2000000000000001e-281 < b

    1. Initial program 27.5%

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5}{\frac{b}{c}}} \]
    5. Simplified64.9%

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

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

Alternative 13: 67.3% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 80.1%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{0.3333333333333333}{a} - b \cdot \frac{0.3333333333333333}{a}} \]
      2. distribute-rgt-out--66.6%

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

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

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

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

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

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

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

        \[\leadsto \frac{b}{a} \cdot \color{blue}{\frac{1}{-1.5}} \]
      3. times-frac62.4%

        \[\leadsto \color{blue}{\frac{b \cdot 1}{a \cdot -1.5}} \]
      4. *-rgt-identity62.4%

        \[\leadsto \frac{\color{blue}{b}}{a \cdot -1.5} \]
    10. Simplified62.4%

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

    if 5.2000000000000001e-281 < b

    1. Initial program 27.5%

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

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

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

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

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

Alternative 14: 11.0% accurate, 23.2× speedup?

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

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

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

    \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
  4. Taylor expanded in b around 0 9.8%

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

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

Alternative 15: 11.0% accurate, 23.2× speedup?

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

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

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

    \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a} + 0.5 \cdot \frac{c}{b}} \]
  4. Taylor expanded in b around 0 9.8%

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

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

      \[\leadsto \color{blue}{\frac{0.5}{\frac{b}{c}}} \]
    3. associate-/r/9.8%

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

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

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

Reproduce

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