quad2p (problem 3.2.1, positive)

?

Percentage Accurate: 51.6% → 87.5%
Time: 11.4s
Precision: binary64
Cost: 7820

?

\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b_2 \cdot b_2 - a \cdot c}\\ \mathbf{if}\;b_2 \leq -1.7 \cdot 10^{+128}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \leq 1.25 \cdot 10^{-146}:\\ \;\;\;\;\frac{t_0 - b_2}{a}\\ \mathbf{elif}\;b_2 \leq 1.16 \cdot 10^{+94}:\\ \;\;\;\;\frac{\frac{a \cdot \left(-c\right)}{b_2 + t_0}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot -0.5\\ \end{array} \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)))))
   (if (<= b_2 -1.7e+128)
     (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))
     (if (<= b_2 1.25e-146)
       (/ (- t_0 b_2) a)
       (if (<= b_2 1.16e+94)
         (/ (/ (* a (- c)) (+ b_2 t_0)) a)
         (* (/ 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)));
	double tmp;
	if (b_2 <= -1.7e+128) {
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	} else if (b_2 <= 1.25e-146) {
		tmp = (t_0 - b_2) / a;
	} else if (b_2 <= 1.16e+94) {
		tmp = ((a * -c) / (b_2 + t_0)) / a;
	} else {
		tmp = (c / b_2) * -0.5;
	}
	return tmp;
}
real(8) function code(a, b_2, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    code = (-b_2 + sqrt(((b_2 * b_2) - (a * c)))) / a
end function
real(8) function code(a, b_2, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt(((b_2 * b_2) - (a * c)))
    if (b_2 <= (-1.7d+128)) then
        tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
    else if (b_2 <= 1.25d-146) then
        tmp = (t_0 - b_2) / a
    else if (b_2 <= 1.16d+94) then
        tmp = ((a * -c) / (b_2 + t_0)) / a
    else
        tmp = (c / b_2) * (-0.5d0)
    end if
    code = tmp
end function
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)));
	double tmp;
	if (b_2 <= -1.7e+128) {
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	} else if (b_2 <= 1.25e-146) {
		tmp = (t_0 - b_2) / a;
	} else if (b_2 <= 1.16e+94) {
		tmp = ((a * -c) / (b_2 + t_0)) / a;
	} else {
		tmp = (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)))
	tmp = 0
	if b_2 <= -1.7e+128:
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2))
	elif b_2 <= 1.25e-146:
		tmp = (t_0 - b_2) / a
	elif b_2 <= 1.16e+94:
		tmp = ((a * -c) / (b_2 + t_0)) / a
	else:
		tmp = (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 = sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))
	tmp = 0.0
	if (b_2 <= -1.7e+128)
		tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2)));
	elseif (b_2 <= 1.25e-146)
		tmp = Float64(Float64(t_0 - b_2) / a);
	elseif (b_2 <= 1.16e+94)
		tmp = Float64(Float64(Float64(a * Float64(-c)) / Float64(b_2 + t_0)) / a);
	else
		tmp = 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)));
	tmp = 0.0;
	if (b_2 <= -1.7e+128)
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	elseif (b_2 <= 1.25e-146)
		tmp = (t_0 - b_2) / a;
	elseif (b_2 <= 1.16e+94)
		tmp = ((a * -c) / (b_2 + t_0)) / a;
	else
		tmp = (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[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b$95$2, -1.7e+128], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 1.25e-146], N[(N[(t$95$0 - b$95$2), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b$95$2, 1.16e+94], N[(N[(N[(a * (-c)), $MachinePrecision] / N[(b$95$2 + t$95$0), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(c / b$95$2), $MachinePrecision] * -0.5), $MachinePrecision]]]]]
\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{b_2 \cdot b_2 - a \cdot c}\\
\mathbf{if}\;b_2 \leq -1.7 \cdot 10^{+128}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \leq 1.25 \cdot 10^{-146}:\\
\;\;\;\;\frac{t_0 - b_2}{a}\\

\mathbf{elif}\;b_2 \leq 1.16 \cdot 10^{+94}:\\
\;\;\;\;\frac{\frac{a \cdot \left(-c\right)}{b_2 + t_0}}{a}\\

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


\end{array}
\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 10 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 b_2 < -1.6999999999999999e128

    1. Initial program 54.1%

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

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

      [Start]54.1%

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

      +-commutative [=>]54.1%

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

      unsub-neg [=>]54.1%

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

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

    if -1.6999999999999999e128 < b_2 < 1.24999999999999989e-146

    1. Initial program 82.4%

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

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

      [Start]82.4%

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

      +-commutative [=>]82.4%

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

      unsub-neg [=>]82.4%

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

    if 1.24999999999999989e-146 < b_2 < 1.1599999999999999e94

    1. Initial program 45.6%

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

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

      [Start]45.6%

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

      +-commutative [=>]45.6%

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

      unsub-neg [=>]45.6%

      \[ \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Applied egg-rr45.6%

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

      [Start]45.6%

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

      add-sqr-sqrt [=>]45.5%

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

      pow2 [=>]45.5%

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

      pow1/2 [=>]45.5%

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

      sqrt-pow1 [=>]45.5%

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

      fma-neg [=>]45.6%

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

      *-commutative [=>]45.6%

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

      distribute-rgt-neg-in [=>]45.6%

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

      metadata-eval [=>]45.6%

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

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

      [Start]45.6%

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

      flip-- [=>]45.2%

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

      pow-pow [=>]45.5%

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

      metadata-eval [=>]45.5%

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

      pow-pow [=>]45.0%

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

      metadata-eval [=>]45.0%

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

      pow-prod-up [=>]45.3%

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

      metadata-eval [=>]45.3%

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

      pow1 [<=]45.3%

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

      distribute-rgt-neg-out [=>]45.3%

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

      fma-neg [<=]45.3%

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

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

      [Start]45.4%

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

      unpow2 [<=]45.4%

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

      unpow2 [<=]45.4%

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

      associate--l- [=>]45.4%

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

      unpow2 [=>]45.4%

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

      unpow2 [=>]45.4%

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

      +-commutative [=>]45.4%

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

      unpow1/2 [=>]45.4%

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

      \[\leadsto \frac{\frac{\color{blue}{\log \left(\frac{e^{b_2 \cdot b_2 - c \cdot a}}{{\left(e^{b_2}\right)}^{b_2}}\right)}}{b_2 + \sqrt{b_2 \cdot b_2 - c \cdot a}}}{a} \]
      Step-by-step derivation

      [Start]45.4%

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

      associate--r+ [=>]45.4%

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

      add-log-exp [=>]4.0%

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

      add-log-exp [=>]3.1%

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

      diff-log [=>]3.1%

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

      add-log-exp [=>]3.1%

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

      exp-to-pow [=>]3.1%

      \[ \frac{\frac{\log \left(\frac{e^{b_2 \cdot b_2 - c \cdot a}}{\color{blue}{{\left(e^{b_2}\right)}^{b_2}}}\right)}{b_2 + \sqrt{b_2 \cdot b_2 - c \cdot a}}}{a} \]
    7. Simplified80.1%

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

      [Start]3.1%

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

      log-div [=>]3.1%

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

      rem-log-exp [=>]29.0%

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

      log-pow [=>]29.2%

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

      rem-log-exp [=>]45.4%

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

      unsub-neg [<=]45.4%

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

      sub-neg [=>]45.4%

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

      +-commutative [<=]45.4%

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

      associate-+l+ [=>]80.1%

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

      distribute-rgt-neg-in [=>]80.1%

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

      sub-neg [<=]80.1%

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

      +-inverses [=>]80.1%

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

    if 1.1599999999999999e94 < b_2

    1. Initial program 8.4%

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

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

      [Start]8.4%

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

      +-commutative [=>]8.4%

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

      unsub-neg [=>]8.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -1.7 \cdot 10^{+128}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \leq 1.25 \cdot 10^{-146}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{elif}\;b_2 \leq 1.16 \cdot 10^{+94}:\\ \;\;\;\;\frac{\frac{a \cdot \left(-c\right)}{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot -0.5\\ \end{array} \]

Alternatives

Alternative 1
Accuracy87.5%
Cost7820
\[\begin{array}{l} t_0 := \sqrt{b_2 \cdot b_2 - a \cdot c}\\ \mathbf{if}\;b_2 \leq -1.7 \cdot 10^{+128}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \leq 1.25 \cdot 10^{-146}:\\ \;\;\;\;\frac{t_0 - b_2}{a}\\ \mathbf{elif}\;b_2 \leq 1.16 \cdot 10^{+94}:\\ \;\;\;\;\frac{\frac{a \cdot \left(-c\right)}{b_2 + t_0}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot -0.5\\ \end{array} \]
Alternative 2
Accuracy84.9%
Cost7432
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -1.65 \cdot 10^{+129}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \leq 5.6 \cdot 10^{-15}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;{\left(0.5 \cdot \frac{a}{b_2} + -2 \cdot \frac{b_2}{c}\right)}^{-1}\\ \end{array} \]
Alternative 3
Accuracy85.2%
Cost7368
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -5 \cdot 10^{+126}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \leq 5.8 \cdot 10^{-15}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot -0.5\\ \end{array} \]
Alternative 4
Accuracy79.7%
Cost7176
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -5.9 \cdot 10^{-25}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \leq 4.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(-c\right)} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot -0.5\\ \end{array} \]
Alternative 5
Accuracy68.7%
Cost836
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -4 \cdot 10^{-310}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot -0.5\\ \end{array} \]
Alternative 6
Accuracy47.8%
Cost452
\[\begin{array}{l} \mathbf{if}\;b_2 \leq 5.5 \cdot 10^{-270}:\\ \;\;\;\;\frac{-b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot -0.5\\ \end{array} \]
Alternative 7
Accuracy68.3%
Cost452
\[\begin{array}{l} \mathbf{if}\;b_2 \leq 3.7 \cdot 10^{-270}:\\ \;\;\;\;\frac{-2}{\frac{a}{b_2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot -0.5\\ \end{array} \]
Alternative 8
Accuracy68.4%
Cost452
\[\begin{array}{l} \mathbf{if}\;b_2 \leq 4.5 \cdot 10^{-270}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot -0.5\\ \end{array} \]
Alternative 9
Accuracy23.4%
Cost388
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-288}:\\ \;\;\;\;\frac{-b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{a}\\ \end{array} \]
Alternative 10
Accuracy10.7%
Cost192
\[\frac{0}{a} \]

Reproduce?

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