?

Average Accuracy: 47.8% → 88.1%
Time: 17.4s
Precision: binary64
Cost: 13832

?

\[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
\[\begin{array}{l} \mathbf{if}\;b \leq -8.5 \cdot 10^{-7}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{-274}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right) - b}\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{+109}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))
(FPCore (a b c)
 :precision binary64
 (if (<= b -8.5e-7)
   (/ (- c) b)
   (if (<= b 4.4e-274)
     (/ (* c 2.0) (- (hypot (sqrt (* c (* a -4.0))) b) b))
     (if (<= b 7.2e+109)
       (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* c a))))) (* 2.0 a))
       (- (/ b a))))))
double code(double a, double b, double c) {
	return (-b - sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
}
double code(double a, double b, double c) {
	double tmp;
	if (b <= -8.5e-7) {
		tmp = -c / b;
	} else if (b <= 4.4e-274) {
		tmp = (c * 2.0) / (hypot(sqrt((c * (a * -4.0))), b) - b);
	} else if (b <= 7.2e+109) {
		tmp = (-b - sqrt(((b * b) - (4.0 * (c * a))))) / (2.0 * a);
	} else {
		tmp = -(b / a);
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	return (-b - Math.sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -8.5e-7) {
		tmp = -c / b;
	} else if (b <= 4.4e-274) {
		tmp = (c * 2.0) / (Math.hypot(Math.sqrt((c * (a * -4.0))), b) - b);
	} else if (b <= 7.2e+109) {
		tmp = (-b - Math.sqrt(((b * b) - (4.0 * (c * a))))) / (2.0 * a);
	} else {
		tmp = -(b / a);
	}
	return tmp;
}
def code(a, b, c):
	return (-b - math.sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a)
def code(a, b, c):
	tmp = 0
	if b <= -8.5e-7:
		tmp = -c / b
	elif b <= 4.4e-274:
		tmp = (c * 2.0) / (math.hypot(math.sqrt((c * (a * -4.0))), b) - b)
	elif b <= 7.2e+109:
		tmp = (-b - math.sqrt(((b * b) - (4.0 * (c * a))))) / (2.0 * a)
	else:
		tmp = -(b / a)
	return tmp
function code(a, b, c)
	return Float64(Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c))))) / Float64(2.0 * a))
end
function code(a, b, c)
	tmp = 0.0
	if (b <= -8.5e-7)
		tmp = Float64(Float64(-c) / b);
	elseif (b <= 4.4e-274)
		tmp = Float64(Float64(c * 2.0) / Float64(hypot(sqrt(Float64(c * Float64(a * -4.0))), b) - b));
	elseif (b <= 7.2e+109)
		tmp = Float64(Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(c * a))))) / Float64(2.0 * a));
	else
		tmp = Float64(-Float64(b / a));
	end
	return tmp
end
function tmp = code(a, b, c)
	tmp = (-b - sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -8.5e-7)
		tmp = -c / b;
	elseif (b <= 4.4e-274)
		tmp = (c * 2.0) / (hypot(sqrt((c * (a * -4.0))), b) - b);
	elseif (b <= 7.2e+109)
		tmp = (-b - sqrt(((b * b) - (4.0 * (c * a))))) / (2.0 * a);
	else
		tmp = -(b / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := N[(N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
code[a_, b_, c_] := If[LessEqual[b, -8.5e-7], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 4.4e-274], N[(N[(c * 2.0), $MachinePrecision] / N[(N[Sqrt[N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2 + b ^ 2], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.2e+109], N[(N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], (-N[(b / a), $MachinePrecision])]]]
\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \leq -8.5 \cdot 10^{-7}:\\
\;\;\;\;\frac{-c}{b}\\

\mathbf{elif}\;b \leq 4.4 \cdot 10^{-274}:\\
\;\;\;\;\frac{c \cdot 2}{\mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right) - b}\\

\mathbf{elif}\;b \leq 7.2 \cdot 10^{+109}:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;-\frac{b}{a}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original47.8%
Target68.0%
Herbie88.1%
\[\begin{array}{l} \mathbf{if}\;b < 0:\\ \;\;\;\;\frac{c}{a \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\\ \end{array} \]

Derivation?

  1. Split input into 4 regimes
  2. if b < -8.50000000000000014e-7

    1. Initial program 13.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    3. Simplified91.1%

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

      [Start]91.1

      \[ -1 \cdot \frac{c}{b} \]

      associate-*r/ [=>]91.1

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

      neg-mul-1 [<=]91.1

      \[ \frac{\color{blue}{-c}}{b} \]

    if -8.50000000000000014e-7 < b < 4.3999999999999999e-274

    1. Initial program 63.4%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Applied egg-rr62.8%

      \[\leadsto \color{blue}{\left(b + \mathsf{hypot}\left(b, \sqrt{\left(-4 \cdot c\right) \cdot a}\right)\right) \cdot \frac{1}{a \cdot -2}} \]
      Proof

      [Start]63.4

      \[ \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]

      frac-2neg [=>]63.4

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

      div-inv [=>]63.4

      \[ \color{blue}{\left(-\left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)\right) \cdot \frac{1}{-2 \cdot a}} \]
    3. Applied egg-rr53.2%

      \[\leadsto \color{blue}{\frac{b \cdot b - \mathsf{fma}\left(-4, c \cdot a, b \cdot b\right)}{\left(a \cdot -2\right) \cdot \left(b - \mathsf{hypot}\left(\sqrt{-4 \cdot \left(c \cdot a\right)}, b\right)\right)}} \]
      Proof

      [Start]62.8

      \[ \left(b + \mathsf{hypot}\left(b, \sqrt{\left(-4 \cdot c\right) \cdot a}\right)\right) \cdot \frac{1}{a \cdot -2} \]

      un-div-inv [=>]62.8

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

      flip-+ [=>]62.8

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

      associate-/l/ [=>]53.2

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

      hypot-udef [=>]53.2

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

      hypot-udef [=>]53.2

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

      add-sqr-sqrt [<=]53.2

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

      add-sqr-sqrt [<=]53.3

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

      +-commutative [=>]53.3

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

      associate-*l* [=>]53.2

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

      fma-def [=>]53.2

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

      \[\leadsto \color{blue}{\frac{\frac{c \cdot \left(a \cdot -4\right) + 0}{a \cdot 2}}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)}} \]
      Proof

      [Start]53.2

      \[ \frac{b \cdot b - \mathsf{fma}\left(-4, c \cdot a, b \cdot b\right)}{\left(a \cdot -2\right) \cdot \left(b - \mathsf{hypot}\left(\sqrt{-4 \cdot \left(c \cdot a\right)}, b\right)\right)} \]

      associate-/r* [=>]62.7

      \[ \color{blue}{\frac{\frac{b \cdot b - \mathsf{fma}\left(-4, c \cdot a, b \cdot b\right)}{a \cdot -2}}{b - \mathsf{hypot}\left(\sqrt{-4 \cdot \left(c \cdot a\right)}, b\right)}} \]
    5. Applied egg-rr18.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{c \cdot a}{a} \cdot -2}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)}\right)} - 1} \]
      Proof

      [Start]68.4

      \[ \frac{\frac{c \cdot \left(a \cdot -4\right) + 0}{a \cdot 2}}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)} \]

      expm1-log1p-u [=>]51.2

      \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{c \cdot \left(a \cdot -4\right) + 0}{a \cdot 2}}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)}\right)\right)} \]

      expm1-udef [=>]18.5

      \[ \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{c \cdot \left(a \cdot -4\right) + 0}{a \cdot 2}}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)}\right)} - 1} \]

      +-rgt-identity [=>]18.5

      \[ e^{\mathsf{log1p}\left(\frac{\frac{\color{blue}{c \cdot \left(a \cdot -4\right)}}{a \cdot 2}}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)}\right)} - 1 \]

      associate-*r* [=>]18.5

      \[ e^{\mathsf{log1p}\left(\frac{\frac{\color{blue}{\left(c \cdot a\right) \cdot -4}}{a \cdot 2}}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)}\right)} - 1 \]

      times-frac [=>]18.5

      \[ e^{\mathsf{log1p}\left(\frac{\color{blue}{\frac{c \cdot a}{a} \cdot \frac{-4}{2}}}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)}\right)} - 1 \]

      metadata-eval [=>]18.5

      \[ e^{\mathsf{log1p}\left(\frac{\frac{c \cdot a}{a} \cdot \color{blue}{-2}}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)}\right)} - 1 \]
    6. Simplified80.4%

      \[\leadsto \color{blue}{\frac{c \cdot 2}{\mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right) - b}} \]
      Proof

      [Start]18.5

      \[ e^{\mathsf{log1p}\left(\frac{\frac{c \cdot a}{a} \cdot -2}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)}\right)} - 1 \]

      expm1-def [=>]51.1

      \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{c \cdot a}{a} \cdot -2}{b - \mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right)}\right)\right)} \]

      expm1-log1p [=>]68.3

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

      *-lft-identity [<=]68.3

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

      metadata-eval [<=]68.3

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

      times-frac [<=]68.3

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

      neg-mul-1 [<=]68.3

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

      neg-mul-1 [<=]68.3

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

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

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

      associate-/l* [=>]80.4

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

      *-inverses [=>]80.4

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

      metadata-eval [=>]80.4

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

      /-rgt-identity [=>]80.4

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

      neg-sub0 [=>]80.4

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

      sub-neg [=>]80.4

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

      +-commutative [=>]80.4

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

      associate--r+ [=>]80.4

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

    if 4.3999999999999999e-274 < b < 7.2e109

    1. Initial program 87.1%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]

    if 7.2e109 < b

    1. Initial program 22.8%

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

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

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

      [Start]94.9

      \[ -1 \cdot \frac{b}{a} \]

      associate-*r/ [=>]94.9

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

      mul-1-neg [=>]94.9

      \[ \frac{\color{blue}{-b}}{a} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification88.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -8.5 \cdot 10^{-7}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{-274}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{hypot}\left(\sqrt{c \cdot \left(a \cdot -4\right)}, b\right) - b}\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{+109}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy85.2%
Cost7688
\[\begin{array}{l} \mathbf{if}\;b \leq -2.7 \cdot 10^{-74}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{+109}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]
Alternative 2
Accuracy79.4%
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{-116}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-58}:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{-4 \cdot \left(c \cdot a\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \]
Alternative 3
Accuracy39.1%
Cost388
\[\begin{array}{l} \mathbf{if}\;b \leq -1.5 \cdot 10^{+35}:\\ \;\;\;\;\frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]
Alternative 4
Accuracy65.1%
Cost388
\[\begin{array}{l} \mathbf{if}\;b \leq -6.4 \cdot 10^{-212}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]
Alternative 5
Accuracy2.6%
Cost192
\[\frac{b}{a} \]
Alternative 6
Accuracy11.8%
Cost192
\[\frac{c}{b} \]

Error

Reproduce?

herbie shell --seed 2023146 
(FPCore (a b c)
  :name "The quadratic formula (r2)"
  :precision binary64

  :herbie-target
  (if (< b 0.0) (/ c (* a (/ (+ (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))) (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))

  (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))