?

Average Error: 34.5 → 7.2
Time: 17.4s
Precision: binary64
Cost: 14284

?

\[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
\[\begin{array}{l} t_0 := \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\\ \mathbf{if}\;b \leq -1.16 \cdot 10^{+95}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-309}:\\ \;\;\;\;\frac{c \cdot -2}{b - t_0}\\ \mathbf{elif}\;b \leq 6.6 \cdot 10^{+78}:\\ \;\;\;\;\frac{b}{a} \cdot -0.5 + t_0 \cdot \frac{-0.5}{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
 (let* ((t_0 (sqrt (fma c (* a -4.0) (* b b)))))
   (if (<= b -1.16e+95)
     (/ (- c) b)
     (if (<= b 4e-309)
       (/ (* c -2.0) (- b t_0))
       (if (<= b 6.6e+78)
         (+ (* (/ b a) -0.5) (* t_0 (/ -0.5 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 t_0 = sqrt(fma(c, (a * -4.0), (b * b)));
	double tmp;
	if (b <= -1.16e+95) {
		tmp = -c / b;
	} else if (b <= 4e-309) {
		tmp = (c * -2.0) / (b - t_0);
	} else if (b <= 6.6e+78) {
		tmp = ((b / a) * -0.5) + (t_0 * (-0.5 / 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)
	t_0 = sqrt(fma(c, Float64(a * -4.0), Float64(b * b)))
	tmp = 0.0
	if (b <= -1.16e+95)
		tmp = Float64(Float64(-c) / b);
	elseif (b <= 4e-309)
		tmp = Float64(Float64(c * -2.0) / Float64(b - t_0));
	elseif (b <= 6.6e+78)
		tmp = Float64(Float64(Float64(b / a) * -0.5) + Float64(t_0 * Float64(-0.5 / a)));
	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_] := Block[{t$95$0 = N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -1.16e+95], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 4e-309], N[(N[(c * -2.0), $MachinePrecision] / N[(b - t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.6e+78], N[(N[(N[(b / a), $MachinePrecision] * -0.5), $MachinePrecision] + N[(t$95$0 * N[(-0.5 / a), $MachinePrecision]), $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}
t_0 := \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\\
\mathbf{if}\;b \leq -1.16 \cdot 10^{+95}:\\
\;\;\;\;\frac{-c}{b}\\

\mathbf{elif}\;b \leq 4 \cdot 10^{-309}:\\
\;\;\;\;\frac{c \cdot -2}{b - t_0}\\

\mathbf{elif}\;b \leq 6.6 \cdot 10^{+78}:\\
\;\;\;\;\frac{b}{a} \cdot -0.5 + t_0 \cdot \frac{-0.5}{a}\\

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


\end{array}

Error?

Target

Original34.5
Target21.5
Herbie7.2
\[\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 < -1.1599999999999999e95

    1. Initial program 59.3

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified59.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]59.3

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

      *-lft-identity [<=]59.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 [<=]59.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/ [=>]59.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/ [<=]59.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 [<=]59.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 [<=]59.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 [<=]59.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* [=>]59.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 [=>]59.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 [=>]59.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 [=>]59.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 [=>]59.3

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

      sub-neg [=>]59.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 [=>]59.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 2.6

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

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

      [Start]2.6

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

      mul-1-neg [=>]2.6

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

      distribute-neg-frac [=>]2.6

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

    if -1.1599999999999999e95 < b < 3.9999999999999977e-309

    1. Initial program 32.7

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

      \[\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]32.7

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

      *-lft-identity [<=]32.7

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

      metadata-eval [<=]32.7

      \[ \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/ [=>]32.7

      \[ \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/ [<=]32.7

      \[ \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 [<=]32.7

      \[ \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 [<=]32.7

      \[ \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 [<=]32.7

      \[ \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* [=>]32.7

      \[ \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 [=>]32.7

      \[ \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 [=>]32.7

      \[ \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 [=>]32.7

      \[ \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 [=>]32.7

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

      sub-neg [=>]32.7

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

      +-commutative [=>]32.7

      \[ \frac{-0.5}{a} \cdot \left(b + \sqrt{\color{blue}{\left(-4 \cdot \left(a \cdot c\right)\right) + b \cdot b}}\right) \]
    3. Applied egg-rr32.7

      \[\leadsto \color{blue}{\frac{\frac{-0.5}{a} \cdot \left(b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\right)}{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}} \]
    4. Taylor expanded in a around 0 9.0

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

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

      [Start]9.0

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

      *-commutative [=>]9.0

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

    if 3.9999999999999977e-309 < b < 6.6e78

    1. Initial program 10.0

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

      \[\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]10.0

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

      *-lft-identity [<=]10.0

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

      metadata-eval [<=]10.0

      \[ \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/ [=>]10.0

      \[ \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/ [<=]10.2

      \[ \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 [<=]10.2

      \[ \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 [<=]10.2

      \[ \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 [<=]10.2

      \[ \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* [=>]10.2

      \[ \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 [=>]10.2

      \[ \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 [=>]10.2

      \[ \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 [=>]10.2

      \[ \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 [=>]10.2

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

      sub-neg [=>]10.2

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

      +-commutative [=>]10.2

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

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

    if 6.6e78 < b

    1. Initial program 43.9

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

      \[\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]43.9

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

      *-lft-identity [<=]43.9

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

      metadata-eval [<=]43.9

      \[ \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/ [=>]43.9

      \[ \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/ [<=]44.0

      \[ \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 [<=]44.0

      \[ \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 [<=]44.0

      \[ \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 [<=]44.0

      \[ \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* [=>]44.0

      \[ \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 [=>]44.0

      \[ \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 [=>]44.0

      \[ \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 [=>]44.0

      \[ \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 [=>]44.0

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

      sub-neg [=>]44.0

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

      +-commutative [=>]44.0

      \[ \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 5.4

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

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

      [Start]5.4

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

      associate-*r/ [=>]5.4

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

      mul-1-neg [=>]5.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.16 \cdot 10^{+95}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-309}:\\ \;\;\;\;\frac{c \cdot -2}{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}\\ \mathbf{elif}\;b \leq 6.6 \cdot 10^{+78}:\\ \;\;\;\;\frac{b}{a} \cdot -0.5 + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)} \cdot \frac{-0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]

Alternatives

Alternative 1
Error7.2
Cost14028
\[\begin{array}{l} t_0 := \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\\ \mathbf{if}\;b \leq -4.2 \cdot 10^{+96}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-309}:\\ \;\;\;\;\frac{c \cdot -2}{b - t_0}\\ \mathbf{elif}\;b \leq 1.4 \cdot 10^{+84}:\\ \;\;\;\;\frac{-0.5}{\frac{a}{b + t_0}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]
Alternative 2
Error10.7
Cost13896
\[\begin{array}{l} \mathbf{if}\;b \leq -1.15 \cdot 10^{-60}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 6.4 \cdot 10^{+83}:\\ \;\;\;\;\frac{-0.5}{\frac{a}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]
Alternative 3
Error10.7
Cost7688
\[\begin{array}{l} \mathbf{if}\;b \leq -9.2 \cdot 10^{-64}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 4.3 \cdot 10^{+80}:\\ \;\;\;\;\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 4
Error14.4
Cost7432
\[\begin{array}{l} \mathbf{if}\;b \leq -1.02 \cdot 10^{-60}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 4.2 \cdot 10^{-7}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{c \cdot \left(a \cdot -4\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]
Alternative 5
Error39.9
Cost388
\[\begin{array}{l} \mathbf{if}\;b \leq -5.3 \cdot 10^{+39}:\\ \;\;\;\;\frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]
Alternative 6
Error23.0
Cost388
\[\begin{array}{l} \mathbf{if}\;b \leq -1.55 \cdot 10^{-307}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]
Alternative 7
Error62.3
Cost192
\[\frac{b}{a} \]
Alternative 8
Error57.0
Cost192
\[\frac{c}{b} \]

Error

Reproduce?

herbie shell --seed 2023032 
(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)))