?

Average Accuracy: 46.3% → 84.4%
Time: 25.9s
Precision: binary64
Cost: 14220

?

\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
\[\begin{array}{l} t_0 := \frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{if}\;b \leq -5 \cdot 10^{+152}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq -2 \cdot 10^{-143}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{-243}:\\ \;\;\;\;\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right) \cdot \frac{0.5}{a} + b \cdot \frac{-0.5}{a}\\ \mathbf{elif}\;b \leq 6 \cdot 10^{-14}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \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
 (let* ((t_0 (/ (- (sqrt (- (* b b) (* (* a 4.0) c))) b) (* a 2.0))))
   (if (<= b -5e+152)
     (/ (- b) a)
     (if (<= b -2e-143)
       t_0
       (if (<= b 1.55e-243)
         (+ (* (hypot b (sqrt (* a (* c -4.0)))) (/ 0.5 a)) (* b (/ -0.5 a)))
         (if (<= b 6e-14) t_0 (/ (- c) b)))))))
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 t_0 = (sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0);
	double tmp;
	if (b <= -5e+152) {
		tmp = -b / a;
	} else if (b <= -2e-143) {
		tmp = t_0;
	} else if (b <= 1.55e-243) {
		tmp = (hypot(b, sqrt((a * (c * -4.0)))) * (0.5 / a)) + (b * (-0.5 / a));
	} else if (b <= 6e-14) {
		tmp = t_0;
	} else {
		tmp = -c / b;
	}
	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 t_0 = (Math.sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0);
	double tmp;
	if (b <= -5e+152) {
		tmp = -b / a;
	} else if (b <= -2e-143) {
		tmp = t_0;
	} else if (b <= 1.55e-243) {
		tmp = (Math.hypot(b, Math.sqrt((a * (c * -4.0)))) * (0.5 / a)) + (b * (-0.5 / a));
	} else if (b <= 6e-14) {
		tmp = t_0;
	} else {
		tmp = -c / b;
	}
	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):
	t_0 = (math.sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0)
	tmp = 0
	if b <= -5e+152:
		tmp = -b / a
	elif b <= -2e-143:
		tmp = t_0
	elif b <= 1.55e-243:
		tmp = (math.hypot(b, math.sqrt((a * (c * -4.0)))) * (0.5 / a)) + (b * (-0.5 / a))
	elif b <= 6e-14:
		tmp = t_0
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
end
function code(a, b, c)
	t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 4.0) * c))) - b) / Float64(a * 2.0))
	tmp = 0.0
	if (b <= -5e+152)
		tmp = Float64(Float64(-b) / a);
	elseif (b <= -2e-143)
		tmp = t_0;
	elseif (b <= 1.55e-243)
		tmp = Float64(Float64(hypot(b, sqrt(Float64(a * Float64(c * -4.0)))) * Float64(0.5 / a)) + Float64(b * Float64(-0.5 / a)));
	elseif (b <= 6e-14)
		tmp = t_0;
	else
		tmp = Float64(Float64(-c) / b);
	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)
	t_0 = (sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0);
	tmp = 0.0;
	if (b <= -5e+152)
		tmp = -b / a;
	elseif (b <= -2e-143)
		tmp = t_0;
	elseif (b <= 1.55e-243)
		tmp = (hypot(b, sqrt((a * (c * -4.0)))) * (0.5 / a)) + (b * (-0.5 / a));
	elseif (b <= 6e-14)
		tmp = t_0;
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(a * 4.0), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -5e+152], N[((-b) / a), $MachinePrecision], If[LessEqual[b, -2e-143], t$95$0, If[LessEqual[b, 1.55e-243], N[(N[(N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision] + N[(b * N[(-0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6e-14], t$95$0, N[((-c) / b), $MachinePrecision]]]]]]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\
\mathbf{if}\;b \leq -5 \cdot 10^{+152}:\\
\;\;\;\;\frac{-b}{a}\\

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

\mathbf{elif}\;b \leq 1.55 \cdot 10^{-243}:\\
\;\;\;\;\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right) \cdot \frac{0.5}{a} + b \cdot \frac{-0.5}{a}\\

\mathbf{elif}\;b \leq 6 \cdot 10^{-14}:\\
\;\;\;\;t_0\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original46.3%
Target66.6%
Herbie84.4%
\[\begin{array}{l} \mathbf{if}\;b < 0:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{a \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}}\\ \end{array} \]

Derivation?

  1. Split input into 4 regimes
  2. if b < -5e152

    1. Initial program 0.9%

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

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

      [Start]0.9

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

      /-rgt-identity [<=]0.9

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

      metadata-eval [<=]0.9

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

      *-commutative [=>]0.9

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

      associate-/l* [=>]0.9

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

      associate-/l* [<=]0.9

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

      associate-*r/ [<=]0.9

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

      /-rgt-identity [<=]0.9

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

      metadata-eval [<=]0.9

      \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{--1}{2}}{a} \]
    3. Taylor expanded in b around -inf 96.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    4. Simplified96.8%

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

      [Start]96.8

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

      associate-*r/ [=>]96.8

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

      mul-1-neg [=>]96.8

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

    if -5e152 < b < -1.9999999999999999e-143 or 1.55e-243 < b < 5.9999999999999997e-14

    1. Initial program 76.9%

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

    if -1.9999999999999999e-143 < b < 1.55e-243

    1. Initial program 75.6%

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

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

      [Start]75.6

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

      /-rgt-identity [<=]75.6

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

      metadata-eval [<=]75.6

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

      *-commutative [=>]75.6

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

      associate-/l* [=>]75.6

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

      associate-/l* [<=]75.6

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

      associate-*r/ [<=]75.5

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

      /-rgt-identity [<=]75.5

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

      metadata-eval [<=]75.5

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

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

      [Start]75.4

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

      *-commutative [=>]75.4

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

      sub-neg [=>]75.4

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

      distribute-rgt-in [=>]75.4

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

      fma-udef [=>]75.4

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

      add-sqr-sqrt [=>]75.3

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

      hypot-def [=>]79.1

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

      associate-*l* [=>]79.2

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

    if 5.9999999999999997e-14 < b

    1. Initial program 13.0%

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

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

      [Start]13.0

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

      *-commutative [=>]13.0

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

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

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

      [Start]91.2

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

      mul-1-neg [=>]91.2

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

      distribute-neg-frac [=>]91.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+152}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq -2 \cdot 10^{-143}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{-243}:\\ \;\;\;\;\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right) \cdot \frac{0.5}{a} + b \cdot \frac{-0.5}{a}\\ \mathbf{elif}\;b \leq 6 \cdot 10^{-14}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy84.2%
Cost14092
\[\begin{array}{l} t_0 := \frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{if}\;b \leq -9.2 \cdot 10^{+153}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq -1 \cdot 10^{-112}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 6 \cdot 10^{-244}:\\ \;\;\;\;\frac{\frac{0.5}{a}}{\frac{1}{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right) - b}}\\ \mathbf{elif}\;b \leq 3.2 \cdot 10^{-14}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 2
Accuracy84.0%
Cost13964
\[\begin{array}{l} t_0 := \frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{if}\;b \leq -1 \cdot 10^{+149}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq -2 \cdot 10^{-143}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq -1.1 \cdot 10^{-181}:\\ \;\;\;\;\frac{0.5}{\frac{a}{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right) - b}}\\ \mathbf{elif}\;b \leq 1.1 \cdot 10^{-13}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 3
Accuracy83.7%
Cost7624
\[\begin{array}{l} \mathbf{if}\;b \leq -8.8 \cdot 10^{+112}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-14}:\\ \;\;\;\;\frac{0.5}{a} \cdot \left(\sqrt{b \cdot b + a \cdot \left(c \cdot -4\right)} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 4
Accuracy83.9%
Cost7624
\[\begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+153}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{-14}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 5
Accuracy78.6%
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -1.65 \cdot 10^{-109}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.65 \cdot 10^{-110}:\\ \;\;\;\;\frac{0.5}{a} \cdot \left(\sqrt{-4 \cdot \left(a \cdot c\right)} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{0.5 \cdot \left(\frac{a}{b} - \frac{b}{c}\right)}\\ \end{array} \]
Alternative 6
Accuracy78.5%
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -3.2 \cdot 10^{-113}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.6 \cdot 10^{-110}:\\ \;\;\;\;\frac{0.5}{a} \cdot \left(\sqrt{c \cdot \left(a \cdot -4\right)} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{0.5 \cdot \left(\frac{a}{b} - \frac{b}{c}\right)}\\ \end{array} \]
Alternative 7
Accuracy78.6%
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -1.6 \cdot 10^{-109}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 3.3 \cdot 10^{-111}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{0.5 \cdot \left(\frac{a}{b} - \frac{b}{c}\right)}\\ \end{array} \]
Alternative 8
Accuracy64.8%
Cost836
\[\begin{array}{l} \mathbf{if}\;b \leq -3.6 \cdot 10^{-302}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.5}{0.5 \cdot \left(\frac{a}{b} - \frac{b}{c}\right)}\\ \end{array} \]
Alternative 9
Accuracy64.9%
Cost388
\[\begin{array}{l} \mathbf{if}\;b \leq 7.5 \cdot 10^{-254}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 10
Accuracy29.1%
Cost256
\[\frac{-b}{a} \]
Alternative 11
Accuracy2.6%
Cost192
\[\frac{b}{a} \]

Error

Reproduce?

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

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

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