?

Average Error: 34.2 → 10.3
Time: 16.9s
Precision: binary64
Cost: 21192

?

\[\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 -3 \cdot 10^{-90}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{+105}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right) + 4 \cdot \mathsf{fma}\left(-c, a \cdot 4, c \cdot \left(a \cdot 4\right)\right)}}{a \cdot 2}\\ \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 -3e-90)
   (/ (- c) b)
   (if (<= b 8.5e+105)
     (/
      (-
       (- b)
       (sqrt
        (+
         (fma b b (* c (* a -4.0)))
         (* 4.0 (fma (- c) (* a 4.0) (* c (* a 4.0)))))))
      (* a 2.0))
     (- (/ 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 <= -3e-90) {
		tmp = -c / b;
	} else if (b <= 8.5e+105) {
		tmp = (-b - sqrt((fma(b, b, (c * (a * -4.0))) + (4.0 * fma(-c, (a * 4.0), (c * (a * 4.0))))))) / (a * 2.0);
	} 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 <= -3e-90)
		tmp = Float64(Float64(-c) / b);
	elseif (b <= 8.5e+105)
		tmp = Float64(Float64(Float64(-b) - sqrt(Float64(fma(b, b, Float64(c * Float64(a * -4.0))) + Float64(4.0 * fma(Float64(-c), Float64(a * 4.0), Float64(c * Float64(a * 4.0))))))) / Float64(a * 2.0));
	else
		tmp = Float64(-Float64(b / a));
	end
	return 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, -3e-90], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 8.5e+105], N[(N[((-b) - N[Sqrt[N[(N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(4.0 * N[((-c) * N[(a * 4.0), $MachinePrecision] + N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $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 -3 \cdot 10^{-90}:\\
\;\;\;\;\frac{-c}{b}\\

\mathbf{elif}\;b \leq 8.5 \cdot 10^{+105}:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right) + 4 \cdot \mathsf{fma}\left(-c, a \cdot 4, c \cdot \left(a \cdot 4\right)\right)}}{a \cdot 2}\\

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


\end{array}

Error?

Target

Original34.2
Target20.9
Herbie10.3
\[\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 3 regimes
  2. if b < -3.0000000000000002e-90

    1. Initial program 52.3

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

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

      [Start]52.3

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

      *-lft-identity [<=]52.3

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

      metadata-eval [<=]52.3

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

      associate-*r/ [=>]52.3

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

      associate-*l/ [<=]52.3

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

      distribute-neg-frac [<=]52.3

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

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

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

      distribute-rgt-neg-out [<=]52.3

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

      associate-/r* [=>]52.3

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

      metadata-eval [=>]52.3

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

      sub-neg [=>]52.3

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

      distribute-neg-out [=>]52.3

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

      remove-double-neg [=>]52.3

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

      sub-neg [=>]52.3

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

      +-commutative [=>]52.3

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

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

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

      [Start]10.3

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

      mul-1-neg [=>]10.3

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

      distribute-neg-frac [=>]10.3

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

    if -3.0000000000000002e-90 < b < 8.49999999999999986e105

    1. Initial program 12.6

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

      \[\leadsto \frac{\left(-b\right) - \sqrt{\color{blue}{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -4\right) + \left(\left(\mathsf{fma}\left(a \cdot \left(-c\right), 4, 4 \cdot \left(a \cdot c\right)\right) + \mathsf{fma}\left(a \cdot \left(-c\right), 4, 4 \cdot \left(a \cdot c\right)\right)\right) + \left(\mathsf{fma}\left(a \cdot \left(-c\right), 4, 4 \cdot \left(a \cdot c\right)\right) + \mathsf{fma}\left(a \cdot \left(-c\right), 4, 4 \cdot \left(a \cdot c\right)\right)\right)\right)}}}{2 \cdot a} \]
    3. Simplified12.7

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

      [Start]12.6

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

      *-commutative [=>]12.6

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

      associate-*l* [=>]12.6

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

      count-2 [=>]12.6

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

      count-2 [=>]12.6

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

      associate-*r* [=>]12.6

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

      metadata-eval [=>]12.6

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

      fma-udef [=>]12.6

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

      *-commutative [=>]12.6

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

      associate-*r* [<=]12.6

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

      *-commutative [<=]12.6

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

      fma-udef [<=]12.7

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

      *-commutative [=>]12.7

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

      associate-*r* [=>]12.7

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

      *-commutative [=>]12.7

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

      *-commutative [=>]12.7

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

    if 8.49999999999999986e105 < b

    1. Initial program 46.5

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

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

      [Start]46.5

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

      *-lft-identity [<=]46.5

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

      metadata-eval [<=]46.5

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

      associate-*r/ [=>]46.5

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

      associate-*l/ [<=]46.6

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

      distribute-neg-frac [<=]46.6

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

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

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

      distribute-rgt-neg-out [<=]46.6

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

      associate-/r* [=>]46.6

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

      metadata-eval [=>]46.6

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

      sub-neg [=>]46.6

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

      distribute-neg-out [=>]46.6

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

      remove-double-neg [=>]46.6

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

      sub-neg [=>]46.6

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

      +-commutative [=>]46.6

      \[ \frac{-0.5}{a} \cdot \left(b + \sqrt{\color{blue}{\left(-4 \cdot \left(a \cdot c\right)\right) + b \cdot b}}\right) \]
    3. Taylor expanded in a around 0 3.3

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    4. Simplified3.3

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

      [Start]3.3

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

      associate-*r/ [=>]3.3

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

      mul-1-neg [=>]3.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{-90}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{+105}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right) + 4 \cdot \mathsf{fma}\left(-c, a \cdot 4, c \cdot \left(a \cdot 4\right)\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]

Alternatives

Alternative 1
Error10.3
Cost13896
\[\begin{array}{l} \mathbf{if}\;b \leq -2.9 \cdot 10^{-92}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 2.2 \cdot 10^{+104}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]
Alternative 2
Error10.2
Cost7688
\[\begin{array}{l} \mathbf{if}\;b \leq -2.3 \cdot 10^{-90}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 9.5 \cdot 10^{+105}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]
Alternative 3
Error13.6
Cost7432
\[\begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{-90}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 1.95 \cdot 10^{-110}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{c \cdot \left(a \cdot -4\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]
Alternative 4
Error39.5
Cost388
\[\begin{array}{l} \mathbf{if}\;b \leq -1.15 \cdot 10^{-9}:\\ \;\;\;\;\frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]
Alternative 5
Error22.5
Cost388
\[\begin{array}{l} \mathbf{if}\;b \leq -1.6 \cdot 10^{-218}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]
Alternative 6
Error62.4
Cost192
\[\frac{b}{a} \]
Alternative 7
Error56.5
Cost192
\[\frac{c}{b} \]

Error

Reproduce?

herbie shell --seed 2023187 
(FPCore (a b c)
  :name "quadm (p42, negative)"
  :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)))