quad2p (problem 3.2.1, positive)

?

Percentage Accurate: 38.9% → 69.3%
Time: 21.8s
Precision: binary64
Cost: 49424

?

\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
\[\begin{array}{l} t_0 := \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{if}\;t_0 \leq -\infty:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{elif}\;t_0 \leq -2 \cdot 10^{-253}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_0 \leq 0:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+234}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + \left({\left({\left(\left(a \cdot \left(c \cdot c\right)\right) \cdot {b_2}^{-3}\right)}^{3} \cdot 0.001953125\right)}^{0.3333333333333333} + \frac{c}{b_2} \cdot 0.5\right)\\ \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
(FPCore (a b_2 c)
 :precision binary64
 (let* ((t_0 (/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)))
   (if (<= t_0 (- INFINITY))
     (/ (* b_2 -2.0) a)
     (if (<= t_0 -2e-253)
       t_0
       (if (<= t_0 0.0)
         (* -0.5 (/ c b_2))
         (if (<= t_0 2e+234)
           t_0
           (+
            (* -2.0 (/ b_2 a))
            (+
             (pow
              (* (pow (* (* a (* c c)) (pow b_2 -3.0)) 3.0) 0.001953125)
              0.3333333333333333)
             (* (/ c b_2) 0.5)))))))))
double code(double a, double b_2, double c) {
	return (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a;
}
double code(double a, double b_2, double c) {
	double t_0 = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = (b_2 * -2.0) / a;
	} else if (t_0 <= -2e-253) {
		tmp = t_0;
	} else if (t_0 <= 0.0) {
		tmp = -0.5 * (c / b_2);
	} else if (t_0 <= 2e+234) {
		tmp = t_0;
	} else {
		tmp = (-2.0 * (b_2 / a)) + (pow((pow(((a * (c * c)) * pow(b_2, -3.0)), 3.0) * 0.001953125), 0.3333333333333333) + ((c / b_2) * 0.5));
	}
	return tmp;
}
public static double code(double a, double b_2, double c) {
	return (-b_2 + Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
}
public static double code(double a, double b_2, double c) {
	double t_0 = (Math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = (b_2 * -2.0) / a;
	} else if (t_0 <= -2e-253) {
		tmp = t_0;
	} else if (t_0 <= 0.0) {
		tmp = -0.5 * (c / b_2);
	} else if (t_0 <= 2e+234) {
		tmp = t_0;
	} else {
		tmp = (-2.0 * (b_2 / a)) + (Math.pow((Math.pow(((a * (c * c)) * Math.pow(b_2, -3.0)), 3.0) * 0.001953125), 0.3333333333333333) + ((c / b_2) * 0.5));
	}
	return tmp;
}
def code(a, b_2, c):
	return (-b_2 + math.sqrt(((b_2 * b_2) - (a * c)))) / a
def code(a, b_2, c):
	t_0 = (math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a
	tmp = 0
	if t_0 <= -math.inf:
		tmp = (b_2 * -2.0) / a
	elif t_0 <= -2e-253:
		tmp = t_0
	elif t_0 <= 0.0:
		tmp = -0.5 * (c / b_2)
	elif t_0 <= 2e+234:
		tmp = t_0
	else:
		tmp = (-2.0 * (b_2 / a)) + (math.pow((math.pow(((a * (c * c)) * math.pow(b_2, -3.0)), 3.0) * 0.001953125), 0.3333333333333333) + ((c / b_2) * 0.5))
	return tmp
function code(a, b_2, c)
	return Float64(Float64(Float64(-b_2) + sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a)
end
function code(a, b_2, c)
	t_0 = Float64(Float64(sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c))) - b_2) / a)
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(Float64(b_2 * -2.0) / a);
	elseif (t_0 <= -2e-253)
		tmp = t_0;
	elseif (t_0 <= 0.0)
		tmp = Float64(-0.5 * Float64(c / b_2));
	elseif (t_0 <= 2e+234)
		tmp = t_0;
	else
		tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64((Float64((Float64(Float64(a * Float64(c * c)) * (b_2 ^ -3.0)) ^ 3.0) * 0.001953125) ^ 0.3333333333333333) + Float64(Float64(c / b_2) * 0.5)));
	end
	return tmp
end
function tmp = code(a, b_2, c)
	tmp = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a;
end
function tmp_2 = code(a, b_2, c)
	t_0 = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = (b_2 * -2.0) / a;
	elseif (t_0 <= -2e-253)
		tmp = t_0;
	elseif (t_0 <= 0.0)
		tmp = -0.5 * (c / b_2);
	elseif (t_0 <= 2e+234)
		tmp = t_0;
	else
		tmp = (-2.0 * (b_2 / a)) + ((((((a * (c * c)) * (b_2 ^ -3.0)) ^ 3.0) * 0.001953125) ^ 0.3333333333333333) + ((c / b_2) * 0.5));
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := N[(N[((-b$95$2) + N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
code[a_, b$95$2_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b$95$2), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t$95$0, -2e-253], t$95$0, If[LessEqual[t$95$0, 0.0], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+234], t$95$0, N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[(N[Power[N[(N[(a * N[(c * c), $MachinePrecision]), $MachinePrecision] * N[Power[b$95$2, -3.0], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision] * 0.001953125), $MachinePrecision], 0.3333333333333333], $MachinePrecision] + N[(N[(c / b$95$2), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}
t_0 := \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\

\mathbf{elif}\;t_0 \leq -2 \cdot 10^{-253}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;-0.5 \cdot \frac{c}{b_2}\\

\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+234}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + \left({\left({\left(\left(a \cdot \left(c \cdot c\right)\right) \cdot {b_2}^{-3}\right)}^{3} \cdot 0.001953125\right)}^{0.3333333333333333} + \frac{c}{b_2} \cdot 0.5\right)\\


\end{array}

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.

Herbie found 19 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

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.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 4 regimes
  2. if (/.f64 (+.f64 (neg.f64 b_2) (sqrt.f64 (-.f64 (*.f64 b_2 b_2) (*.f64 a c)))) a) < -inf.0

    1. Initial program 25.6%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Simplified25.6%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
      Step-by-step derivation

      [Start]25.6%

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

      +-commutative [=>]25.6%

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

      unsub-neg [=>]25.6%

      \[ \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Taylor expanded in b_2 around -inf 62.3%

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

      \[\leadsto \frac{\color{blue}{b_2 \cdot -2}}{a} \]
      Step-by-step derivation

      [Start]62.3%

      \[ \frac{-2 \cdot b_2}{a} \]

      *-commutative [=>]62.3%

      \[ \frac{\color{blue}{b_2 \cdot -2}}{a} \]

    if -inf.0 < (/.f64 (+.f64 (neg.f64 b_2) (sqrt.f64 (-.f64 (*.f64 b_2 b_2) (*.f64 a c)))) a) < -2.0000000000000001e-253 or 0.0 < (/.f64 (+.f64 (neg.f64 b_2) (sqrt.f64 (-.f64 (*.f64 b_2 b_2) (*.f64 a c)))) a) < 2.00000000000000004e234

    1. Initial program 87.1%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Simplified87.1%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
      Step-by-step derivation

      [Start]87.1%

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

      +-commutative [=>]87.1%

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

      unsub-neg [=>]87.1%

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

    if -2.0000000000000001e-253 < (/.f64 (+.f64 (neg.f64 b_2) (sqrt.f64 (-.f64 (*.f64 b_2 b_2) (*.f64 a c)))) a) < 0.0

    1. Initial program 17.3%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Simplified17.3%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
      Step-by-step derivation

      [Start]17.3%

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

      +-commutative [=>]17.3%

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

      unsub-neg [=>]17.3%

      \[ \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Taylor expanded in b_2 around inf 100.0%

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

    if 2.00000000000000004e234 < (/.f64 (+.f64 (neg.f64 b_2) (sqrt.f64 (-.f64 (*.f64 b_2 b_2) (*.f64 a c)))) a)

    1. Initial program 9.4%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Simplified9.4%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
      Step-by-step derivation

      [Start]9.4%

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

      +-commutative [=>]9.4%

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

      unsub-neg [=>]9.4%

      \[ \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Taylor expanded in b_2 around -inf 34.6%

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a} + \left(0.125 \cdot \frac{{c}^{2} \cdot a}{{b_2}^{3}} + 0.5 \cdot \frac{c}{b_2}\right)} \]
    4. Applied egg-rr54.7%

      \[\leadsto -2 \cdot \frac{b_2}{a} + \left(\color{blue}{{\left({\left(\left(a \cdot \left(c \cdot c\right)\right) \cdot {b_2}^{-3}\right)}^{3} \cdot 0.001953125\right)}^{0.3333333333333333}} + 0.5 \cdot \frac{c}{b_2}\right) \]
      Step-by-step derivation

      [Start]34.6%

      \[ -2 \cdot \frac{b_2}{a} + \left(0.125 \cdot \frac{{c}^{2} \cdot a}{{b_2}^{3}} + 0.5 \cdot \frac{c}{b_2}\right) \]

      add-cbrt-cube [=>]34.6%

      \[ -2 \cdot \frac{b_2}{a} + \left(\color{blue}{\sqrt[3]{\left(\left(0.125 \cdot \frac{{c}^{2} \cdot a}{{b_2}^{3}}\right) \cdot \left(0.125 \cdot \frac{{c}^{2} \cdot a}{{b_2}^{3}}\right)\right) \cdot \left(0.125 \cdot \frac{{c}^{2} \cdot a}{{b_2}^{3}}\right)}} + 0.5 \cdot \frac{c}{b_2}\right) \]

      pow1/3 [=>]53.7%

      \[ -2 \cdot \frac{b_2}{a} + \left(\color{blue}{{\left(\left(\left(0.125 \cdot \frac{{c}^{2} \cdot a}{{b_2}^{3}}\right) \cdot \left(0.125 \cdot \frac{{c}^{2} \cdot a}{{b_2}^{3}}\right)\right) \cdot \left(0.125 \cdot \frac{{c}^{2} \cdot a}{{b_2}^{3}}\right)\right)}^{0.3333333333333333}} + 0.5 \cdot \frac{c}{b_2}\right) \]

      pow3 [=>]53.7%

      \[ -2 \cdot \frac{b_2}{a} + \left({\color{blue}{\left({\left(0.125 \cdot \frac{{c}^{2} \cdot a}{{b_2}^{3}}\right)}^{3}\right)}}^{0.3333333333333333} + 0.5 \cdot \frac{c}{b_2}\right) \]

      *-commutative [=>]53.7%

      \[ -2 \cdot \frac{b_2}{a} + \left({\left({\color{blue}{\left(\frac{{c}^{2} \cdot a}{{b_2}^{3}} \cdot 0.125\right)}}^{3}\right)}^{0.3333333333333333} + 0.5 \cdot \frac{c}{b_2}\right) \]

      unpow-prod-down [=>]53.7%

      \[ -2 \cdot \frac{b_2}{a} + \left({\color{blue}{\left({\left(\frac{{c}^{2} \cdot a}{{b_2}^{3}}\right)}^{3} \cdot {0.125}^{3}\right)}}^{0.3333333333333333} + 0.5 \cdot \frac{c}{b_2}\right) \]

      div-inv [=>]53.7%

      \[ -2 \cdot \frac{b_2}{a} + \left({\left({\color{blue}{\left(\left({c}^{2} \cdot a\right) \cdot \frac{1}{{b_2}^{3}}\right)}}^{3} \cdot {0.125}^{3}\right)}^{0.3333333333333333} + 0.5 \cdot \frac{c}{b_2}\right) \]

      *-commutative [=>]53.7%

      \[ -2 \cdot \frac{b_2}{a} + \left({\left({\left(\color{blue}{\left(a \cdot {c}^{2}\right)} \cdot \frac{1}{{b_2}^{3}}\right)}^{3} \cdot {0.125}^{3}\right)}^{0.3333333333333333} + 0.5 \cdot \frac{c}{b_2}\right) \]

      unpow2 [=>]53.7%

      \[ -2 \cdot \frac{b_2}{a} + \left({\left({\left(\left(a \cdot \color{blue}{\left(c \cdot c\right)}\right) \cdot \frac{1}{{b_2}^{3}}\right)}^{3} \cdot {0.125}^{3}\right)}^{0.3333333333333333} + 0.5 \cdot \frac{c}{b_2}\right) \]

      pow-flip [=>]54.7%

      \[ -2 \cdot \frac{b_2}{a} + \left({\left({\left(\left(a \cdot \left(c \cdot c\right)\right) \cdot \color{blue}{{b_2}^{\left(-3\right)}}\right)}^{3} \cdot {0.125}^{3}\right)}^{0.3333333333333333} + 0.5 \cdot \frac{c}{b_2}\right) \]

      metadata-eval [=>]54.7%

      \[ -2 \cdot \frac{b_2}{a} + \left({\left({\left(\left(a \cdot \left(c \cdot c\right)\right) \cdot {b_2}^{\color{blue}{-3}}\right)}^{3} \cdot {0.125}^{3}\right)}^{0.3333333333333333} + 0.5 \cdot \frac{c}{b_2}\right) \]

      metadata-eval [=>]54.7%

      \[ -2 \cdot \frac{b_2}{a} + \left({\left({\left(\left(a \cdot \left(c \cdot c\right)\right) \cdot {b_2}^{-3}\right)}^{3} \cdot \color{blue}{0.001953125}\right)}^{0.3333333333333333} + 0.5 \cdot \frac{c}{b_2}\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification73.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a} \leq -\infty:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{elif}\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a} \leq -2 \cdot 10^{-253}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{elif}\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a} \leq 0:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a} \leq 2 \cdot 10^{+234}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + \left({\left({\left(\left(a \cdot \left(c \cdot c\right)\right) \cdot {b_2}^{-3}\right)}^{3} \cdot 0.001953125\right)}^{0.3333333333333333} + \frac{c}{b_2} \cdot 0.5\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy69.3%
Cost49424
\[\begin{array}{l} t_0 := \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{if}\;t_0 \leq -\infty:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{elif}\;t_0 \leq -2 \cdot 10^{-253}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_0 \leq 0:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+234}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + \left({\left({\left(\left(a \cdot \left(c \cdot c\right)\right) \cdot {b_2}^{-3}\right)}^{3} \cdot 0.001953125\right)}^{0.3333333333333333} + \frac{c}{b_2} \cdot 0.5\right)\\ \end{array} \]
Alternative 2
Accuracy65.5%
Cost20232
\[\begin{array}{l} t_0 := \frac{c}{\frac{\frac{{b_2}^{3}}{c}}{a}}\\ t_1 := a \cdot \left(-c\right)\\ t_2 := a \cdot \frac{c}{b_2}\\ \mathbf{if}\;b_2 \leq -6.2 \cdot 10^{+73}:\\ \;\;\;\;\frac{\left(0.5 \cdot \sqrt[3]{t_2 \cdot \left(t_2 \cdot t_2\right)} - b_2\right) - b_2}{a}\\ \mathbf{elif}\;b_2 \leq -2.75 \cdot 10^{-201}:\\ \;\;\;\;\frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, t_1\right)\right)}^{0.25}\right)}^{2} - b_2}{a}\\ \mathbf{elif}\;b_2 \leq -4.5 \cdot 10^{-285}:\\ \;\;\;\;-0.125 \cdot t_0\\ \mathbf{elif}\;b_2 \leq 3.8 \cdot 10^{-89}:\\ \;\;\;\;\frac{{\left({t_1}^{0.25}\right)}^{2} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.125, t_0, -0.5 \cdot \frac{c}{b_2}\right)\\ \end{array} \]
Alternative 3
Accuracy64.7%
Cost14224
\[\begin{array}{l} t_0 := \frac{c}{\frac{\frac{{b_2}^{3}}{c}}{a}}\\ t_1 := a \cdot \frac{c}{b_2}\\ \mathbf{if}\;b_2 \leq -1.76 \cdot 10^{+74}:\\ \;\;\;\;\frac{\left(0.5 \cdot \sqrt[3]{t_1 \cdot \left(t_1 \cdot t_1\right)} - b_2\right) - b_2}{a}\\ \mathbf{elif}\;b_2 \leq -2.3 \cdot 10^{-200}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{elif}\;b_2 \leq -8.8 \cdot 10^{-290}:\\ \;\;\;\;-0.125 \cdot t_0\\ \mathbf{elif}\;b_2 \leq 2.4 \cdot 10^{-88}:\\ \;\;\;\;\frac{{\left({\left(a \cdot \left(-c\right)\right)}^{0.25}\right)}^{2} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.125, t_0, -0.5 \cdot \frac{c}{b_2}\right)\\ \end{array} \]
Alternative 4
Accuracy64.5%
Cost13968
\[\begin{array}{l} t_0 := \frac{{b_2}^{3}}{c}\\ t_1 := a \cdot \frac{c}{b_2}\\ \mathbf{if}\;b_2 \leq -1.15 \cdot 10^{+74}:\\ \;\;\;\;\frac{\left(0.5 \cdot \sqrt[3]{t_1 \cdot \left(t_1 \cdot t_1\right)} - b_2\right) - b_2}{a}\\ \mathbf{elif}\;b_2 \leq -1.35 \cdot 10^{-201}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{elif}\;b_2 \leq -1.15 \cdot 10^{-286}:\\ \;\;\;\;-0.125 \cdot \frac{c}{\frac{t_0}{a}}\\ \mathbf{elif}\;b_2 \leq 3.6 \cdot 10^{-89}:\\ \;\;\;\;\frac{{\left({\left(a \cdot \left(-c\right)\right)}^{0.25}\right)}^{2} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2} + -0.125 \cdot \left(a \cdot \frac{c}{t_0}\right)\\ \end{array} \]
Alternative 5
Accuracy61.5%
Cost8336
\[\begin{array}{l} t_0 := \frac{{b_2}^{3}}{c}\\ t_1 := -2 \cdot \frac{b_2}{a}\\ t_2 := \frac{c}{b_2} \cdot 0.5\\ \mathbf{if}\;b_2 \leq -3.4 \cdot 10^{+74}:\\ \;\;\;\;t_1 + t_2\\ \mathbf{elif}\;b_2 \leq -2.4 \cdot 10^{-200}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{elif}\;b_2 \leq 5.9 \cdot 10^{-241}:\\ \;\;\;\;-0.125 \cdot \frac{c}{\frac{t_0}{a}}\\ \mathbf{elif}\;b_2 \leq 3 \cdot 10^{-141}:\\ \;\;\;\;t_1 + \left(t_2 + \left(c \cdot \left(c \cdot {b_2}^{-3}\right)\right) \cdot \left(a \cdot 0.125\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2} + -0.125 \cdot \left(a \cdot \frac{c}{t_0}\right)\\ \end{array} \]
Alternative 6
Accuracy61.1%
Cost8336
\[\begin{array}{l} t_0 := \frac{{b_2}^{3}}{c}\\ t_1 := a \cdot \frac{c}{b_2}\\ \mathbf{if}\;b_2 \leq -3.05 \cdot 10^{+74}:\\ \;\;\;\;\frac{\left(0.5 \cdot \sqrt[3]{t_1 \cdot \left(t_1 \cdot t_1\right)} - b_2\right) - b_2}{a}\\ \mathbf{elif}\;b_2 \leq -1.6 \cdot 10^{-199}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{elif}\;b_2 \leq 1.65 \cdot 10^{-227}:\\ \;\;\;\;-0.125 \cdot \frac{c}{\frac{t_0}{a}}\\ \mathbf{elif}\;b_2 \leq 2.7 \cdot 10^{-142}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + \left(\frac{c}{b_2} \cdot 0.5 + \left(c \cdot \left(c \cdot {b_2}^{-3}\right)\right) \cdot \left(a \cdot 0.125\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2} + -0.125 \cdot \left(a \cdot \frac{c}{t_0}\right)\\ \end{array} \]
Alternative 7
Accuracy57.6%
Cost7704
\[\begin{array}{l} t_0 := \frac{\sqrt{a \cdot \left(-c\right)} - b_2}{a}\\ t_1 := \frac{c}{\frac{b_2}{a}}\\ \mathbf{if}\;b_2 \leq -3 \cdot 10^{+37}:\\ \;\;\;\;\frac{\left(0.5 \cdot t_1 - b_2\right) - b_2}{a}\\ \mathbf{elif}\;b_2 \leq -3.05 \cdot 10^{-68}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b_2 \leq -7.4 \cdot 10^{-149}:\\ \;\;\;\;\frac{b_2 \cdot -2 + 0.5 \cdot \frac{a \cdot c}{b_2}}{a}\\ \mathbf{elif}\;b_2 \leq -1.15 \cdot 10^{-208}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b_2 \leq -3.65 \cdot 10^{-301}:\\ \;\;\;\;\frac{-0.5 \cdot t_1}{a}\\ \mathbf{elif}\;b_2 \leq 5.1 \cdot 10^{-138}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \end{array} \]
Alternative 8
Accuracy56.3%
Cost7700
\[\begin{array}{l} t_0 := \frac{\sqrt{a \cdot \left(-c\right)} - b_2}{a}\\ \mathbf{if}\;b_2 \leq -3 \cdot 10^{+37}:\\ \;\;\;\;\frac{\left(0.5 \cdot \frac{c}{\frac{b_2}{a}} - b_2\right) - b_2}{a}\\ \mathbf{elif}\;b_2 \leq -1.1 \cdot 10^{-68}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b_2 \leq -1.25 \cdot 10^{-146}:\\ \;\;\;\;\frac{b_2 \cdot -2 + 0.5 \cdot \frac{a \cdot c}{b_2}}{a}\\ \mathbf{elif}\;b_2 \leq -7.5 \cdot 10^{-200}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b_2 \leq 4 \cdot 10^{-155}:\\ \;\;\;\;-0.125 \cdot \frac{c}{\frac{\frac{{b_2}^{3}}{c}}{a}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \end{array} \]
Alternative 9
Accuracy56.3%
Cost7700
\[\begin{array}{l} t_0 := \sqrt{a \cdot \left(-c\right)}\\ \mathbf{if}\;b_2 \leq -3 \cdot 10^{+37}:\\ \;\;\;\;\frac{\left(0.5 \cdot \frac{c}{\frac{b_2}{a}} - b_2\right) - b_2}{a}\\ \mathbf{elif}\;b_2 \leq -3.1 \cdot 10^{-68}:\\ \;\;\;\;\frac{t_0}{a} - \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \leq -8.5 \cdot 10^{-144}:\\ \;\;\;\;\frac{b_2 \cdot -2 + 0.5 \cdot \frac{a \cdot c}{b_2}}{a}\\ \mathbf{elif}\;b_2 \leq -3.4 \cdot 10^{-199}:\\ \;\;\;\;\frac{t_0 - b_2}{a}\\ \mathbf{elif}\;b_2 \leq 3.8 \cdot 10^{-155}:\\ \;\;\;\;-0.125 \cdot \frac{c}{\frac{\frac{{b_2}^{3}}{c}}{a}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \end{array} \]
Alternative 10
Accuracy61.7%
Cost7688
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -3 \cdot 10^{+74}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + \frac{c}{b_2} \cdot 0.5\\ \mathbf{elif}\;b_2 \leq -1.48 \cdot 10^{-201}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2} + -0.125 \cdot \left(a \cdot \frac{c}{\frac{{b_2}^{3}}{c}}\right)\\ \end{array} \]
Alternative 11
Accuracy61.3%
Cost7436
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -1.4 \cdot 10^{+74}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + \frac{c}{b_2} \cdot 0.5\\ \mathbf{elif}\;b_2 \leq -1.3 \cdot 10^{-199}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{elif}\;b_2 \leq 4.5 \cdot 10^{-155}:\\ \;\;\;\;-0.125 \cdot \frac{c}{\frac{\frac{{b_2}^{3}}{c}}{a}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \end{array} \]
Alternative 12
Accuracy56.4%
Cost1100
\[\begin{array}{l} t_0 := \frac{c}{\frac{b_2}{a}}\\ \mathbf{if}\;b_2 \leq -2.45 \cdot 10^{-201}:\\ \;\;\;\;\frac{\left(0.5 \cdot t_0 - b_2\right) - b_2}{a}\\ \mathbf{elif}\;b_2 \leq 5 \cdot 10^{-157}:\\ \;\;\;\;\frac{-0.5 \cdot t_0}{a}\\ \mathbf{elif}\;b_2 \leq 6 \cdot 10^{-142}:\\ \;\;\;\;\frac{0.5 \cdot \left(c \cdot \frac{a}{b_2}\right) - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \end{array} \]
Alternative 13
Accuracy55.5%
Cost964
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -1.55 \cdot 10^{-201}:\\ \;\;\;\;\frac{b_2 \cdot -2 + 0.5 \cdot \frac{a \cdot c}{b_2}}{a}\\ \mathbf{elif}\;b_2 \leq 2.7 \cdot 10^{-159}:\\ \;\;\;\;\frac{-0.5 \cdot \frac{c}{\frac{b_2}{a}}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \end{array} \]
Alternative 14
Accuracy54.6%
Cost840
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -1.9 \cdot 10^{-198}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{elif}\;b_2 \leq 2 \cdot 10^{-160}:\\ \;\;\;\;\frac{-0.5 \cdot \frac{c}{\frac{b_2}{a}}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \end{array} \]
Alternative 15
Accuracy55.5%
Cost840
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -5.4 \cdot 10^{-200}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + \frac{c}{b_2} \cdot 0.5\\ \mathbf{elif}\;b_2 \leq 4.3 \cdot 10^{-160}:\\ \;\;\;\;\frac{-0.5 \cdot \frac{c}{\frac{b_2}{a}}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \end{array} \]
Alternative 16
Accuracy38.4%
Cost452
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -2.35 \cdot 10^{-198}:\\ \;\;\;\;\frac{-b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \end{array} \]
Alternative 17
Accuracy53.4%
Cost452
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -1.9 \cdot 10^{-198}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \end{array} \]
Alternative 18
Accuracy18.4%
Cost388
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{-b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{a}\\ \end{array} \]
Alternative 19
Accuracy9.2%
Cost192
\[\frac{0}{a} \]

Reproduce?

herbie shell --seed 2023255 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  :precision binary64
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))