?

Average Accuracy: 46.2% → 86.4%
Time: 16.7s
Precision: binary64
Cost: 8136

?

\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
\[\begin{array}{l} t_0 := \sqrt{b_2 \cdot b_2 - c \cdot a}\\ \mathbf{if}\;b_2 \leq -2.55 \cdot 10^{+64}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \mathbf{elif}\;b_2 \leq 5 \cdot 10^{-305}:\\ \;\;\;\;\frac{\frac{\left(b_2 \cdot b_2 - b_2 \cdot b_2\right) - c \cdot a}{a}}{b_2 - t_0}\\ \mathbf{elif}\;b_2 \leq 2.1 \cdot 10^{+140}:\\ \;\;\;\;\frac{\left(-b_2\right) - t_0}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \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) (* c a)))))
   (if (<= b_2 -2.55e+64)
     (/ (* c -0.5) b_2)
     (if (<= b_2 5e-305)
       (/ (/ (- (- (* b_2 b_2) (* b_2 b_2)) (* c a)) a) (- b_2 t_0))
       (if (<= b_2 2.1e+140) (/ (- (- b_2) t_0) a) (* -2.0 (/ b_2 a)))))))
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) - (c * a)));
	double tmp;
	if (b_2 <= -2.55e+64) {
		tmp = (c * -0.5) / b_2;
	} else if (b_2 <= 5e-305) {
		tmp = ((((b_2 * b_2) - (b_2 * b_2)) - (c * a)) / a) / (b_2 - t_0);
	} else if (b_2 <= 2.1e+140) {
		tmp = (-b_2 - t_0) / a;
	} else {
		tmp = -2.0 * (b_2 / a);
	}
	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) - (c * a)))
    if (b_2 <= (-2.55d+64)) then
        tmp = (c * (-0.5d0)) / b_2
    else if (b_2 <= 5d-305) then
        tmp = ((((b_2 * b_2) - (b_2 * b_2)) - (c * a)) / a) / (b_2 - t_0)
    else if (b_2 <= 2.1d+140) then
        tmp = (-b_2 - t_0) / a
    else
        tmp = (-2.0d0) * (b_2 / a)
    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) - (c * a)));
	double tmp;
	if (b_2 <= -2.55e+64) {
		tmp = (c * -0.5) / b_2;
	} else if (b_2 <= 5e-305) {
		tmp = ((((b_2 * b_2) - (b_2 * b_2)) - (c * a)) / a) / (b_2 - t_0);
	} else if (b_2 <= 2.1e+140) {
		tmp = (-b_2 - t_0) / a;
	} else {
		tmp = -2.0 * (b_2 / a);
	}
	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) - (c * a)))
	tmp = 0
	if b_2 <= -2.55e+64:
		tmp = (c * -0.5) / b_2
	elif b_2 <= 5e-305:
		tmp = ((((b_2 * b_2) - (b_2 * b_2)) - (c * a)) / a) / (b_2 - t_0)
	elif b_2 <= 2.1e+140:
		tmp = (-b_2 - t_0) / a
	else:
		tmp = -2.0 * (b_2 / a)
	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(c * a)))
	tmp = 0.0
	if (b_2 <= -2.55e+64)
		tmp = Float64(Float64(c * -0.5) / b_2);
	elseif (b_2 <= 5e-305)
		tmp = Float64(Float64(Float64(Float64(Float64(b_2 * b_2) - Float64(b_2 * b_2)) - Float64(c * a)) / a) / Float64(b_2 - t_0));
	elseif (b_2 <= 2.1e+140)
		tmp = Float64(Float64(Float64(-b_2) - t_0) / a);
	else
		tmp = Float64(-2.0 * Float64(b_2 / a));
	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) - (c * a)));
	tmp = 0.0;
	if (b_2 <= -2.55e+64)
		tmp = (c * -0.5) / b_2;
	elseif (b_2 <= 5e-305)
		tmp = ((((b_2 * b_2) - (b_2 * b_2)) - (c * a)) / a) / (b_2 - t_0);
	elseif (b_2 <= 2.1e+140)
		tmp = (-b_2 - t_0) / a;
	else
		tmp = -2.0 * (b_2 / a);
	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[(c * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b$95$2, -2.55e+64], N[(N[(c * -0.5), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 5e-305], N[(N[(N[(N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(b$95$2 * b$95$2), $MachinePrecision]), $MachinePrecision] - N[(c * a), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] / N[(b$95$2 - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$2, 2.1e+140], N[(N[((-b$95$2) - t$95$0), $MachinePrecision] / a), $MachinePrecision], N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision]]]]]
\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}
t_0 := \sqrt{b_2 \cdot b_2 - c \cdot a}\\
\mathbf{if}\;b_2 \leq -2.55 \cdot 10^{+64}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\

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

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

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\


\end{array}

Error?

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 < -2.55000000000000012e64

    1. Initial program 9.3%

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

      \[\leadsto \frac{\color{blue}{-0.5 \cdot \frac{c \cdot a}{b_2}}}{a} \]
    3. Simplified72.1%

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

      [Start]75.5

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

      associate-/l* [=>]72.1

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

      associate-*r/ [=>]72.1

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

      *-commutative [=>]72.1

      \[ \frac{\frac{\color{blue}{c \cdot -0.5}}{\frac{b_2}{a}}}{a} \]
    4. Applied egg-rr70.2%

      \[\leadsto \color{blue}{\frac{c \cdot \frac{1}{a}}{\frac{b_2}{a}} \cdot -0.5} \]
    5. Taylor expanded in c around 0 94.4%

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

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

      [Start]94.4

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

      associate-*r/ [=>]94.4

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

      *-commutative [=>]94.4

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

    if -2.55000000000000012e64 < b_2 < 4.99999999999999985e-305

    1. Initial program 52.2%

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

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

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

      [Start]52.2

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

      *-commutative [=>]52.2

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

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

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

      [Start]44.4

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

      associate-/l* [<=]44.5

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

      times-frac [=>]52.1

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

      associate-*r/ [=>]52.2

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

      associate-*l/ [=>]52.3

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

      mul-1-neg [=>]52.3

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

      associate--r- [=>]74.3

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

    if 4.99999999999999985e-305 < b_2 < 2.1000000000000002e140

    1. Initial program 86.3%

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

    if 2.1000000000000002e140 < b_2

    1. Initial program 6.2%

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

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification86.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -2.55 \cdot 10^{+64}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \mathbf{elif}\;b_2 \leq 5 \cdot 10^{-305}:\\ \;\;\;\;\frac{\frac{\left(b_2 \cdot b_2 - b_2 \cdot b_2\right) - c \cdot a}{a}}{b_2 - \sqrt{b_2 \cdot b_2 - c \cdot a}}\\ \mathbf{elif}\;b_2 \leq 2.1 \cdot 10^{+140}:\\ \;\;\;\;\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} \]

Alternatives

Alternative 1
Accuracy84.5%
Cost7696
\[\begin{array}{l} t_0 := \sqrt{b_2 \cdot b_2 - c \cdot a}\\ \mathbf{if}\;b_2 \leq -6.2 \cdot 10^{+17}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \mathbf{elif}\;b_2 \leq -2.6 \cdot 10^{-92}:\\ \;\;\;\;\frac{c \cdot \left(-a\right)}{a \cdot \left(b_2 - t_0\right)}\\ \mathbf{elif}\;b_2 \leq -2.2 \cdot 10^{-138}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \leq 2 \cdot 10^{+134}:\\ \;\;\;\;\frac{\left(-b_2\right) - t_0}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array} \]
Alternative 2
Accuracy86.0%
Cost7688
\[\begin{array}{l} t_0 := \sqrt{b_2 \cdot b_2 - c \cdot a}\\ \mathbf{if}\;b_2 \leq -1.15 \cdot 10^{+52}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \mathbf{elif}\;b_2 \leq -5 \cdot 10^{-134}:\\ \;\;\;\;\frac{\frac{c \cdot \left(-a\right)}{b_2 - t_0}}{a}\\ \mathbf{elif}\;b_2 \leq 2.85 \cdot 10^{+140}:\\ \;\;\;\;\frac{\left(-b_2\right) - t_0}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array} \]
Alternative 3
Accuracy83.7%
Cost7432
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -6.5 \cdot 10^{-18}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \mathbf{elif}\;b_2 \leq 2 \cdot 10^{+140}:\\ \;\;\;\;\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
Accuracy78.2%
Cost7240
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -2.4 \cdot 10^{-18}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \mathbf{elif}\;b_2 \leq 3.5 \cdot 10^{-40}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{c \cdot \left(-a\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + \frac{c}{b_2} \cdot 0.5\\ \end{array} \]
Alternative 5
Accuracy38.5%
Cost452
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array} \]
Alternative 6
Accuracy64.4%
Cost452
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -1.9 \cdot 10^{-242}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array} \]
Alternative 7
Accuracy64.3%
Cost452
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -1.5 \cdot 10^{-231}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array} \]
Alternative 8
Accuracy16.9%
Cost388
\[\begin{array}{l} \mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{-b_2}{a}\\ \end{array} \]
Alternative 9
Accuracy12.2%
Cost64
\[0 \]

Error

Reproduce?

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