quad2m (problem 3.2.1, negative)

?

Percentage Accurate: 51.7% → 86.5%
Time: 16.2s
Precision: binary64
Cost: 14932

?

\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
\[\begin{array}{l} t_0 := c \cdot \left(-a\right)\\ t_1 := \sqrt{t_0}\\ t_2 := \frac{-0.5 \cdot c}{b_2}\\ \mathbf{if}\;b_2 \leq -53000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b_2 \leq -2.2 \cdot 10^{-67}:\\ \;\;\;\;\frac{\frac{t_0}{b_2 - \mathsf{hypot}\left(b_2, t_1\right)}}{a}\\ \mathbf{elif}\;b_2 \leq -3 \cdot 10^{-81}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b_2 \leq 5 \cdot 10^{-152}:\\ \;\;\;\;\frac{\left(-b_2\right) - \mathsf{hypot}\left(t_1, b_2\right)}{a}\\ \mathbf{elif}\;b_2 \leq 4.5 \cdot 10^{+142}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + -0.5 \cdot \left(b_2 \cdot \left(2 \cdot \frac{c - c}{{b_2}^{2}} - \frac{c}{{b_2}^{2}}\right)\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 (* c (- a))) (t_1 (sqrt t_0)) (t_2 (/ (* -0.5 c) b_2)))
   (if (<= b_2 -53000.0)
     t_2
     (if (<= b_2 -2.2e-67)
       (/ (/ t_0 (- b_2 (hypot b_2 t_1))) a)
       (if (<= b_2 -3e-81)
         t_2
         (if (<= b_2 5e-152)
           (/ (- (- b_2) (hypot t_1 b_2)) a)
           (if (<= b_2 4.5e+142)
             (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* c a)))) a)
             (+
              (* -2.0 (/ b_2 a))
              (*
               -0.5
               (*
                b_2
                (-
                 (* 2.0 (/ (- c c) (pow b_2 2.0)))
                 (/ c (pow b_2 2.0)))))))))))))
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 = c * -a;
	double t_1 = sqrt(t_0);
	double t_2 = (-0.5 * c) / b_2;
	double tmp;
	if (b_2 <= -53000.0) {
		tmp = t_2;
	} else if (b_2 <= -2.2e-67) {
		tmp = (t_0 / (b_2 - hypot(b_2, t_1))) / a;
	} else if (b_2 <= -3e-81) {
		tmp = t_2;
	} else if (b_2 <= 5e-152) {
		tmp = (-b_2 - hypot(t_1, b_2)) / a;
	} else if (b_2 <= 4.5e+142) {
		tmp = (-b_2 - sqrt(((b_2 * b_2) - (c * a)))) / a;
	} else {
		tmp = (-2.0 * (b_2 / a)) + (-0.5 * (b_2 * ((2.0 * ((c - c) / pow(b_2, 2.0))) - (c / pow(b_2, 2.0)))));
	}
	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 = c * -a;
	double t_1 = Math.sqrt(t_0);
	double t_2 = (-0.5 * c) / b_2;
	double tmp;
	if (b_2 <= -53000.0) {
		tmp = t_2;
	} else if (b_2 <= -2.2e-67) {
		tmp = (t_0 / (b_2 - Math.hypot(b_2, t_1))) / a;
	} else if (b_2 <= -3e-81) {
		tmp = t_2;
	} else if (b_2 <= 5e-152) {
		tmp = (-b_2 - Math.hypot(t_1, b_2)) / a;
	} else if (b_2 <= 4.5e+142) {
		tmp = (-b_2 - Math.sqrt(((b_2 * b_2) - (c * a)))) / a;
	} else {
		tmp = (-2.0 * (b_2 / a)) + (-0.5 * (b_2 * ((2.0 * ((c - c) / Math.pow(b_2, 2.0))) - (c / Math.pow(b_2, 2.0)))));
	}
	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 = c * -a
	t_1 = math.sqrt(t_0)
	t_2 = (-0.5 * c) / b_2
	tmp = 0
	if b_2 <= -53000.0:
		tmp = t_2
	elif b_2 <= -2.2e-67:
		tmp = (t_0 / (b_2 - math.hypot(b_2, t_1))) / a
	elif b_2 <= -3e-81:
		tmp = t_2
	elif b_2 <= 5e-152:
		tmp = (-b_2 - math.hypot(t_1, b_2)) / a
	elif b_2 <= 4.5e+142:
		tmp = (-b_2 - math.sqrt(((b_2 * b_2) - (c * a)))) / a
	else:
		tmp = (-2.0 * (b_2 / a)) + (-0.5 * (b_2 * ((2.0 * ((c - c) / math.pow(b_2, 2.0))) - (c / math.pow(b_2, 2.0)))))
	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(c * Float64(-a))
	t_1 = sqrt(t_0)
	t_2 = Float64(Float64(-0.5 * c) / b_2)
	tmp = 0.0
	if (b_2 <= -53000.0)
		tmp = t_2;
	elseif (b_2 <= -2.2e-67)
		tmp = Float64(Float64(t_0 / Float64(b_2 - hypot(b_2, t_1))) / a);
	elseif (b_2 <= -3e-81)
		tmp = t_2;
	elseif (b_2 <= 5e-152)
		tmp = Float64(Float64(Float64(-b_2) - hypot(t_1, b_2)) / a);
	elseif (b_2 <= 4.5e+142)
		tmp = Float64(Float64(Float64(-b_2) - sqrt(Float64(Float64(b_2 * b_2) - Float64(c * a)))) / a);
	else
		tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(-0.5 * Float64(b_2 * Float64(Float64(2.0 * Float64(Float64(c - c) / (b_2 ^ 2.0))) - Float64(c / (b_2 ^ 2.0))))));
	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 = c * -a;
	t_1 = sqrt(t_0);
	t_2 = (-0.5 * c) / b_2;
	tmp = 0.0;
	if (b_2 <= -53000.0)
		tmp = t_2;
	elseif (b_2 <= -2.2e-67)
		tmp = (t_0 / (b_2 - hypot(b_2, t_1))) / a;
	elseif (b_2 <= -3e-81)
		tmp = t_2;
	elseif (b_2 <= 5e-152)
		tmp = (-b_2 - hypot(t_1, b_2)) / a;
	elseif (b_2 <= 4.5e+142)
		tmp = (-b_2 - sqrt(((b_2 * b_2) - (c * a)))) / a;
	else
		tmp = (-2.0 * (b_2 / a)) + (-0.5 * (b_2 * ((2.0 * ((c - c) / (b_2 ^ 2.0))) - (c / (b_2 ^ 2.0)))));
	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[(c * (-a)), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision]}, If[LessEqual[b$95$2, -53000.0], t$95$2, If[LessEqual[b$95$2, -2.2e-67], N[(N[(t$95$0 / N[(b$95$2 - N[Sqrt[b$95$2 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b$95$2, -3e-81], t$95$2, If[LessEqual[b$95$2, 5e-152], N[(N[((-b$95$2) - N[Sqrt[t$95$1 ^ 2 + b$95$2 ^ 2], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b$95$2, 4.5e+142], N[(N[((-b$95$2) - N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(c * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(b$95$2 * N[(N[(2.0 * N[(N[(c - c), $MachinePrecision] / N[Power[b$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / N[Power[b$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}
t_0 := c \cdot \left(-a\right)\\
t_1 := \sqrt{t_0}\\
t_2 := \frac{-0.5 \cdot c}{b_2}\\
\mathbf{if}\;b_2 \leq -53000:\\
\;\;\;\;t_2\\

\mathbf{elif}\;b_2 \leq -2.2 \cdot 10^{-67}:\\
\;\;\;\;\frac{\frac{t_0}{b_2 - \mathsf{hypot}\left(b_2, t_1\right)}}{a}\\

\mathbf{elif}\;b_2 \leq -3 \cdot 10^{-81}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;b_2 \leq 5 \cdot 10^{-152}:\\
\;\;\;\;\frac{\left(-b_2\right) - \mathsf{hypot}\left(t_1, b_2\right)}{a}\\

\mathbf{elif}\;b_2 \leq 4.5 \cdot 10^{+142}:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\

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


\end{array}

Local Percentage Accuracy?

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 12 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each of Herbie's proposed alternatives. Up and to the right is better. Each dot represents an alternative program; the red square represents the initial program.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 5 regimes
  2. if b_2 < -53000 or -2.2000000000000001e-67 < b_2 < -2.9999999999999999e-81

    1. Initial program 18.2%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf 94.2%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b_2}} \]
    3. Simplified94.2%

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

      [Start]94.2

      \[ -0.5 \cdot \frac{c}{b_2} \]

      associate-*r/ [=>]94.2

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

    if -53000 < b_2 < -2.2000000000000001e-67

    1. Initial program 59.6%

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

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

      [Start]59.6

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

      add-sqr-sqrt [=>]60.4

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

      pow2 [=>]60.4

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

      pow1/2 [=>]60.4

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

      sqrt-pow1 [=>]60.6

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

      metadata-eval [=>]60.6

      \[ \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.25}}\right)}^{2}}{a} \]
    3. Applied egg-rr59.1%

      \[\leadsto \frac{\color{blue}{\frac{-\left(b_2 \cdot b_2 - \left(b_2 \cdot b_2 - a \cdot c\right)\right)}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}}{a} \]
      Step-by-step derivation

      [Start]60.6

      \[ \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}{a} \]

      flip-- [=>]60.6

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

      frac-2neg [=>]60.6

      \[ \frac{\color{blue}{\frac{-\left(\left(-b_2\right) \cdot \left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2} \cdot {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}\right)}{-\left(\left(-b_2\right) + {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}\right)}}}{a} \]
    4. Simplified83.0%

      \[\leadsto \frac{\color{blue}{\frac{c \cdot \left(-a\right)}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right)}}}{a} \]
      Step-by-step derivation

      [Start]59.1

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

      unpow2 [<=]59.1

      \[ \frac{\frac{-\left(\color{blue}{{b_2}^{2}} - \left(b_2 \cdot b_2 - a \cdot c\right)\right)}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a} \]

      unpow2 [<=]59.1

      \[ \frac{\frac{-\left({b_2}^{2} - \left(\color{blue}{{b_2}^{2}} - a \cdot c\right)\right)}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a} \]

      associate--r- [=>]83.0

      \[ \frac{\frac{-\color{blue}{\left(\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c\right)}}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a} \]

      +-inverses [=>]83.0

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

      *-commutative [<=]83.0

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

      distribute-neg-in [=>]83.0

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

      metadata-eval [=>]83.0

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

      sub-neg [<=]83.0

      \[ \frac{\frac{\color{blue}{0 - c \cdot a}}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)}}{a} \]

      neg-sub0 [<=]83.0

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

      distribute-rgt-neg-in [=>]83.0

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

      *-commutative [<=]83.0

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

      distribute-rgt-neg-in [=>]83.0

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

    if -2.9999999999999999e-81 < b_2 < 4.9999999999999997e-152

    1. Initial program 77.4%

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

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{\mathsf{hypot}\left(\sqrt{c \cdot \left(-a\right)}, b_2\right)}}{a} \]
      Step-by-step derivation

      [Start]77.4

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

      sub-neg [=>]77.4

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

      +-commutative [=>]77.4

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

      add-sqr-sqrt [=>]77.4

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

      hypot-def [=>]85.1

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

      *-commutative [=>]85.1

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

      distribute-rgt-neg-in [=>]85.1

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

    if 4.9999999999999997e-152 < b_2 < 4.4999999999999999e142

    1. Initial program 88.6%

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

    if 4.4999999999999999e142 < b_2

    1. Initial program 38.1%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Applied egg-rr38.0%

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

      [Start]38.1

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

      add-sqr-sqrt [=>]38.0

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

      pow2 [=>]38.0

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

      pow1/2 [=>]38.0

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

      sqrt-pow1 [=>]38.0

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

      metadata-eval [=>]38.0

      \[ \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.25}}\right)}^{2}}{a} \]
    3. Applied egg-rr37.4%

      \[\leadsto \frac{\left(-b_2\right) - {\left({\color{blue}{\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \mathsf{fma}\left(a, -c, a \cdot c\right)\right)\right)}}^{0.25}\right)}^{2}}{a} \]
      Step-by-step derivation

      [Start]38.0

      \[ \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}{a} \]

      prod-diff [=>]37.4

      \[ \frac{\left(-b_2\right) - {\left({\color{blue}{\left(\mathsf{fma}\left(b_2, b_2, -c \cdot a\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}}^{0.25}\right)}^{2}}{a} \]

      *-commutative [<=]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\mathsf{fma}\left(b_2, b_2, -\color{blue}{a \cdot c}\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}^{0.25}\right)}^{2}}{a} \]

      fma-neg [<=]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}^{0.25}\right)}^{2}}{a} \]

      prod-diff [=>]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\color{blue}{\left(\mathsf{fma}\left(b_2, b_2, -c \cdot a\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}^{0.25}\right)}^{2}}{a} \]

      *-commutative [<=]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(\mathsf{fma}\left(b_2, b_2, -\color{blue}{a \cdot c}\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}^{0.25}\right)}^{2}}{a} \]

      fma-neg [<=]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}^{0.25}\right)}^{2}}{a} \]

      associate-+l+ [=>]37.4

      \[ \frac{\left(-b_2\right) - {\left({\color{blue}{\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(-c, a, c \cdot a\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}}^{0.25}\right)}^{2}}{a} \]

      *-commutative [<=]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(-c, a, \color{blue}{a \cdot c}\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}^{0.25}\right)}^{2}}{a} \]

      fma-udef [=>]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\color{blue}{\left(\left(-c\right) \cdot a + a \cdot c\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}^{0.25}\right)}^{2}}{a} \]

      distribute-lft-neg-in [<=]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\left(\color{blue}{\left(-c \cdot a\right)} + a \cdot c\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}^{0.25}\right)}^{2}}{a} \]

      *-commutative [<=]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\left(\left(-\color{blue}{a \cdot c}\right) + a \cdot c\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}^{0.25}\right)}^{2}}{a} \]

      distribute-rgt-neg-in [=>]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\left(\color{blue}{a \cdot \left(-c\right)} + a \cdot c\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}^{0.25}\right)}^{2}}{a} \]

      fma-def [=>]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\color{blue}{\mathsf{fma}\left(a, -c, a \cdot c\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)\right)}^{0.25}\right)}^{2}}{a} \]

      *-commutative [<=]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \mathsf{fma}\left(-c, a, \color{blue}{a \cdot c}\right)\right)\right)}^{0.25}\right)}^{2}}{a} \]

      fma-udef [=>]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \color{blue}{\left(\left(-c\right) \cdot a + a \cdot c\right)}\right)\right)}^{0.25}\right)}^{2}}{a} \]

      distribute-lft-neg-in [<=]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \left(\color{blue}{\left(-c \cdot a\right)} + a \cdot c\right)\right)\right)}^{0.25}\right)}^{2}}{a} \]

      *-commutative [<=]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \left(\left(-\color{blue}{a \cdot c}\right) + a \cdot c\right)\right)\right)}^{0.25}\right)}^{2}}{a} \]

      distribute-rgt-neg-in [=>]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \left(\color{blue}{a \cdot \left(-c\right)} + a \cdot c\right)\right)\right)}^{0.25}\right)}^{2}}{a} \]

      fma-def [=>]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \color{blue}{\mathsf{fma}\left(a, -c, a \cdot c\right)}\right)\right)}^{0.25}\right)}^{2}}{a} \]
    4. Simplified37.4%

      \[\leadsto \frac{\left(-b_2\right) - {\left({\color{blue}{\left(\left(b_2 \cdot b_2 - c \cdot a\right) + 2 \cdot \mathsf{fma}\left(a, -c, c \cdot a\right)\right)}}^{0.25}\right)}^{2}}{a} \]
      Step-by-step derivation

      [Start]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \mathsf{fma}\left(a, -c, a \cdot c\right)\right)\right)}^{0.25}\right)}^{2}}{a} \]

      *-commutative [=>]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - \color{blue}{c \cdot a}\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \mathsf{fma}\left(a, -c, a \cdot c\right)\right)\right)}^{0.25}\right)}^{2}}{a} \]

      count-2 [=>]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - c \cdot a\right) + \color{blue}{2 \cdot \mathsf{fma}\left(a, -c, a \cdot c\right)}\right)}^{0.25}\right)}^{2}}{a} \]

      *-commutative [=>]37.4

      \[ \frac{\left(-b_2\right) - {\left({\left(\left(b_2 \cdot b_2 - c \cdot a\right) + 2 \cdot \mathsf{fma}\left(a, -c, \color{blue}{c \cdot a}\right)\right)}^{0.25}\right)}^{2}}{a} \]
    5. Taylor expanded in a around 0 90.5%

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a} + -0.5 \cdot \left(b_2 \cdot \left(2 \cdot \frac{c + -1 \cdot c}{{b_2}^{2}} - \frac{c}{{b_2}^{2}}\right)\right)} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification89.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -53000:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{elif}\;b_2 \leq -2.2 \cdot 10^{-67}:\\ \;\;\;\;\frac{\frac{c \cdot \left(-a\right)}{b_2 - \mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right)}}{a}\\ \mathbf{elif}\;b_2 \leq -3 \cdot 10^{-81}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{elif}\;b_2 \leq 5 \cdot 10^{-152}:\\ \;\;\;\;\frac{\left(-b_2\right) - \mathsf{hypot}\left(\sqrt{c \cdot \left(-a\right)}, b_2\right)}{a}\\ \mathbf{elif}\;b_2 \leq 4.5 \cdot 10^{+142}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + -0.5 \cdot \left(b_2 \cdot \left(2 \cdot \frac{c - c}{{b_2}^{2}} - \frac{c}{{b_2}^{2}}\right)\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy86.4%
Cost13968
\[\begin{array}{l} t_0 := c \cdot \left(-a\right)\\ t_1 := \sqrt{t_0}\\ t_2 := \frac{-0.5 \cdot c}{b_2}\\ \mathbf{if}\;b_2 \leq -235000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b_2 \leq -9.5 \cdot 10^{-66}:\\ \;\;\;\;\frac{\frac{t_0}{b_2 - \mathsf{hypot}\left(b_2, t_1\right)}}{a}\\ \mathbf{elif}\;b_2 \leq -2.3 \cdot 10^{-81}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b_2 \leq 5 \cdot 10^{-152}:\\ \;\;\;\;\frac{\left(-b_2\right) - \mathsf{hypot}\left(t_1, b_2\right)}{a}\\ \mathbf{elif}\;b_2 \leq 5 \cdot 10^{+142}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array} \]
Alternative 2
Accuracy86.9%
Cost13704
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -1.65 \cdot 10^{-81}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{elif}\;b_2 \leq 5 \cdot 10^{-152}:\\ \;\;\;\;\frac{\left(-b_2\right) - \mathsf{hypot}\left(\sqrt{c \cdot \left(-a\right)}, b_2\right)}{a}\\ \mathbf{elif}\;b_2 \leq 5.2 \cdot 10^{+144}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array} \]
Alternative 3
Accuracy86.4%
Cost7432
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -2.1 \cdot 10^{-81}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{elif}\;b_2 \leq 2 \cdot 10^{+143}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array} \]
Alternative 4
Accuracy81.2%
Cost7240
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -1.9 \cdot 10^{-81}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{elif}\;b_2 \leq 2.45 \cdot 10^{-46}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{c \cdot \left(-a\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \end{array} \]
Alternative 5
Accuracy68.7%
Cost836
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \end{array} \]
Alternative 6
Accuracy68.7%
Cost836
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + \frac{0.5}{\frac{b_2}{c}}\\ \end{array} \]
Alternative 7
Accuracy43.9%
Cost452
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -3.55 \cdot 10^{-221}:\\ \;\;\;\;\frac{0}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array} \]
Alternative 8
Accuracy68.1%
Cost452
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{-0.5}{\frac{b_2}{c}}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array} \]
Alternative 9
Accuracy68.5%
Cost452
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array} \]
Alternative 10
Accuracy23.4%
Cost388
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -3.05 \cdot 10^{-221}:\\ \;\;\;\;\frac{0}{a}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b_2}{a}\\ \end{array} \]
Alternative 11
Accuracy10.9%
Cost192
\[\frac{0}{a} \]

Reproduce?

herbie shell --seed 2023161 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))