Average Error: 34.8 → 8.4
Time: 14.8s
Precision: binary64
Cost: 14092
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
\[\begin{array}{l} t_0 := c \cdot \left(a \cdot -4\right)\\ \mathbf{if}\;b \leq -4 \cdot 10^{+126}:\\ \;\;\;\;\frac{b \cdot -2 + 2 \cdot \frac{c}{\frac{b}{a}}}{2 \cdot a}\\ \mathbf{elif}\;b \leq -6 \cdot 10^{-210}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, t_0\right)} - b}{2 \cdot a}\\ \mathbf{elif}\;b \leq 4.8:\\ \;\;\;\;\frac{1}{\frac{b + \mathsf{hypot}\left(b, \sqrt{t_0}\right)}{\frac{c}{-0.5}}}\\ \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 (* c (* a -4.0))))
   (if (<= b -4e+126)
     (/ (+ (* b -2.0) (* 2.0 (/ c (/ b a)))) (* 2.0 a))
     (if (<= b -6e-210)
       (/ (- (sqrt (fma b b t_0)) b) (* 2.0 a))
       (if (<= b 4.8)
         (/ 1.0 (/ (+ b (hypot b (sqrt t_0))) (/ c -0.5)))
         (/ (- 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 = c * (a * -4.0);
	double tmp;
	if (b <= -4e+126) {
		tmp = ((b * -2.0) + (2.0 * (c / (b / a)))) / (2.0 * a);
	} else if (b <= -6e-210) {
		tmp = (sqrt(fma(b, b, t_0)) - b) / (2.0 * a);
	} else if (b <= 4.8) {
		tmp = 1.0 / ((b + hypot(b, sqrt(t_0))) / (c / -0.5));
	} 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(c * Float64(a * -4.0))
	tmp = 0.0
	if (b <= -4e+126)
		tmp = Float64(Float64(Float64(b * -2.0) + Float64(2.0 * Float64(c / Float64(b / a)))) / Float64(2.0 * a));
	elseif (b <= -6e-210)
		tmp = Float64(Float64(sqrt(fma(b, b, t_0)) - b) / Float64(2.0 * a));
	elseif (b <= 4.8)
		tmp = Float64(1.0 / Float64(Float64(b + hypot(b, sqrt(t_0))) / Float64(c / -0.5)));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return 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[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -4e+126], N[(N[(N[(b * -2.0), $MachinePrecision] + N[(2.0 * N[(c / N[(b / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -6e-210], N[(N[(N[Sqrt[N[(b * b + t$95$0), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.8], N[(1.0 / N[(N[(b + N[Sqrt[b ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(c / -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 := c \cdot \left(a \cdot -4\right)\\
\mathbf{if}\;b \leq -4 \cdot 10^{+126}:\\
\;\;\;\;\frac{b \cdot -2 + 2 \cdot \frac{c}{\frac{b}{a}}}{2 \cdot a}\\

\mathbf{elif}\;b \leq -6 \cdot 10^{-210}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, t_0\right)} - b}{2 \cdot a}\\

\mathbf{elif}\;b \leq 4.8:\\
\;\;\;\;\frac{1}{\frac{b + \mathsf{hypot}\left(b, \sqrt{t_0}\right)}{\frac{c}{-0.5}}}\\

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


\end{array}

Error

Derivation

  1. Split input into 4 regimes
  2. if b < -3.9999999999999997e126

    1. Initial program 55.0

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}} \]
      Proof
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 c (*.f64 a -4)))) b) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 c (*.f64 a (Rewrite<= metadata-eval (neg.f64 4)))))) b) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 c (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 a 4)))))) b) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 c (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 4 a)))))) b) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 c (*.f64 4 a)))))) b) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 4 a) c))))) b) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) b) (*.f64 a 2)): 1 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) (neg.f64 b))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (Rewrite<= *-commutative_binary64 (*.f64 2 a))): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in b around -inf 9.4

      \[\leadsto \frac{\color{blue}{2 \cdot \frac{c \cdot a}{b} + -2 \cdot b}}{a \cdot 2} \]
    4. Simplified2.7

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(b, -2, \frac{c \cdot 2}{\frac{b}{a}}\right)}}{a \cdot 2} \]
      Proof
      (fma.f64 b -2 (/.f64 (*.f64 c 2) (/.f64 b a))): 0 points increase in error, 0 points decrease in error
      (fma.f64 b -2 (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 c (/.f64 b a)) 2))): 0 points increase in error, 0 points decrease in error
      (fma.f64 b -2 (*.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 c a) b)) 2)): 16 points increase in error, 25 points decrease in error
      (fma.f64 b -2 (Rewrite<= *-commutative_binary64 (*.f64 2 (/.f64 (*.f64 c a) b)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= fma-def_binary64 (+.f64 (*.f64 b -2) (*.f64 2 (/.f64 (*.f64 c a) b)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 -2 b)) (*.f64 2 (/.f64 (*.f64 c a) b))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 2 (/.f64 (*.f64 c a) b)) (*.f64 -2 b))): 0 points increase in error, 0 points decrease in error
    5. Applied egg-rr2.6

      \[\leadsto \frac{\color{blue}{b \cdot -2 + 2 \cdot \frac{c}{\frac{b}{a}}}}{a \cdot 2} \]

    if -3.9999999999999997e126 < b < -6.0000000000000003e-210

    1. Initial program 7.8

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}} \]
      Proof
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 c (*.f64 a -4)))) b) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 c (*.f64 a (Rewrite<= metadata-eval (neg.f64 4)))))) b) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 c (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 a 4)))))) b) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 c (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 4 a)))))) b) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 c (*.f64 4 a)))))) b) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (fma.f64 b b (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 4 a) c))))) b) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (-.f64 (sqrt.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) b) (*.f64 a 2)): 1 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) (neg.f64 b))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (Rewrite<= *-commutative_binary64 (*.f64 2 a))): 0 points increase in error, 0 points decrease in error

    if -6.0000000000000003e-210 < b < 4.79999999999999982

    1. Initial program 25.2

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right) \cdot \frac{0.5}{a}} \]
      Proof
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (*.f64 c -4) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (*.f64 c (Rewrite<= metadata-eval (neg.f64 4))) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 c 4))) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (neg.f64 (Rewrite=> *-commutative_binary64 (*.f64 4 c))) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (Rewrite=> distribute-lft-neg-in_binary64 (*.f64 (neg.f64 4) c)) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 a (*.f64 (neg.f64 4) c)) (*.f64 b b)))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (+.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 a (neg.f64 4)) c)) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (+.f64 (*.f64 (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 a 4))) c) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (+.f64 (*.f64 (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 4 a))) c) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 b b) (*.f64 (neg.f64 (*.f64 4 a)) c)))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (Rewrite<= cancel-sign-sub-inv_binary64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) (neg.f64 b))) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= +-commutative_binary64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (/.f64 (Rewrite<= metadata-eval (/.f64 1 2)) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (/.f64 (/.f64 (Rewrite<= metadata-eval (neg.f64 -1)) 2) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (Rewrite<= associate-/r*_binary64 (/.f64 (neg.f64 -1) (*.f64 2 a)))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (neg.f64 -1)) (*.f64 2 a))): 9 points increase in error, 13 points decrease in error
      (Rewrite=> associate-/l*_binary64 (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (/.f64 (*.f64 2 a) (neg.f64 -1)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (/.f64 (*.f64 2 a) (Rewrite=> metadata-eval 1))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (Rewrite=> /-rgt-identity_binary64 (*.f64 2 a))): 0 points increase in error, 0 points decrease in error
    3. Applied egg-rr25.1

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\left(\left(b + \mathsf{hypot}\left(\sqrt{a \cdot \left(c \cdot -4\right)}, b\right)\right) \cdot \frac{2}{a \cdot \left(c \cdot -4\right) + 0}\right)} \cdot a} \]
      Proof
      (*.f64 (+.f64 b (hypot.f64 (sqrt.f64 (*.f64 a (*.f64 c -4))) b)) (/.f64 2 (+.f64 (*.f64 a (*.f64 c -4)) 0))): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 b (hypot.f64 (sqrt.f64 (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 c -4) a))) b)) (/.f64 2 (+.f64 (*.f64 a (*.f64 c -4)) 0))): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 b (hypot.f64 (sqrt.f64 (Rewrite<= associate-*r*_binary64 (*.f64 c (*.f64 -4 a)))) b)) (/.f64 2 (+.f64 (*.f64 a (*.f64 c -4)) 0))): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 b (hypot.f64 (sqrt.f64 (*.f64 c (*.f64 -4 a))) b)) (/.f64 2 (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 c -4) a)) 0))): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 b (hypot.f64 (sqrt.f64 (*.f64 c (*.f64 -4 a))) b)) (/.f64 2 (+.f64 (Rewrite<= associate-*r*_binary64 (*.f64 c (*.f64 -4 a))) 0))): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 b (hypot.f64 (sqrt.f64 (*.f64 c (*.f64 -4 a))) b)) (/.f64 2 (+.f64 (*.f64 c (*.f64 -4 a)) (Rewrite<= +-inverses_binary64 (-.f64 (*.f64 b b) (*.f64 b b)))))): 32 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 b (hypot.f64 (sqrt.f64 (*.f64 c (*.f64 -4 a))) b)) (/.f64 2 (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (*.f64 c (*.f64 -4 a)) (*.f64 b b)) (*.f64 b b))))): 27 points increase in error, 1 points decrease in error
      (*.f64 (+.f64 b (hypot.f64 (sqrt.f64 (*.f64 c (*.f64 -4 a))) b)) (/.f64 2 (-.f64 (Rewrite<= fma-udef_binary64 (fma.f64 c (*.f64 -4 a) (*.f64 b b))) (*.f64 b b)))): 1 points increase in error, 0 points decrease in error
      (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 2 (-.f64 (fma.f64 c (*.f64 -4 a) (*.f64 b b)) (*.f64 b b))) (+.f64 b (hypot.f64 (sqrt.f64 (*.f64 c (*.f64 -4 a))) b)))): 0 points increase in error, 0 points decrease in error
    7. Applied egg-rr22.1

      \[\leadsto \frac{1}{\color{blue}{0 + a \cdot \left(\frac{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}{a \cdot c} \cdot -0.5\right)}} \]
    8. Simplified14.7

      \[\leadsto \frac{1}{\color{blue}{\frac{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)}{\frac{c}{-0.5}}}} \]
      Proof
      (/.f64 (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 c (*.f64 a -4))))) (/.f64 c -1/2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 b (hypot.f64 b (sqrt.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 c a) -4))))) (/.f64 c -1/2)): 1 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 (Rewrite<= *-commutative_binary64 (*.f64 a c)) -4)))) (/.f64 c -1/2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 b (hypot.f64 b (sqrt.f64 (Rewrite<= associate-*r*_binary64 (*.f64 a (*.f64 c -4)))))) (/.f64 c -1/2)): 0 points increase in error, 1 points decrease in error
      (/.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4))))))) (/.f64 c -1/2)): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 1 (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4)))))) (/.f64 c (Rewrite<= metadata-eval (/.f64 2 -4)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 1 (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4)))))) (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 c -4) 2))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*r/_binary64 (*.f64 1 (/.f64 (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4))))) (/.f64 (*.f64 c -4) 2)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= *-inverses_binary64 (/.f64 a a)) (/.f64 (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4))))) (/.f64 (*.f64 c -4) 2))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 a a) (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4))))) 2) (*.f64 c -4)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= times-frac_binary64 (/.f64 (*.f64 a (*.f64 (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4))))) 2)) (*.f64 a (*.f64 c -4)))): 52 points increase in error, 10 points decrease in error
      (/.f64 (Rewrite=> associate-*r*_binary64 (*.f64 (*.f64 a (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4)))))) 2)) (*.f64 a (*.f64 c -4))): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 (*.f64 a (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4)))))) 2) (Rewrite=> associate-*r*_binary64 (*.f64 (*.f64 a c) -4))): 0 points increase in error, 1 points decrease in error
      (Rewrite=> times-frac_binary64 (*.f64 (/.f64 (*.f64 a (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4)))))) (*.f64 a c)) (/.f64 2 -4))): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= associate-*r/_binary64 (*.f64 a (/.f64 (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4))))) (*.f64 a c)))) (/.f64 2 -4)): 18 points increase in error, 25 points decrease in error
      (*.f64 (*.f64 a (/.f64 (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4))))) (*.f64 a c))) (Rewrite=> metadata-eval -1/2)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*r*_binary64 (*.f64 a (*.f64 (/.f64 (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4))))) (*.f64 a c)) -1/2))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-lft-identity_binary64 (+.f64 0 (*.f64 a (*.f64 (/.f64 (+.f64 b (hypot.f64 b (sqrt.f64 (*.f64 a (*.f64 c -4))))) (*.f64 a c)) -1/2)))): 0 points increase in error, 0 points decrease in error

    if 4.79999999999999982 < b

    1. Initial program 55.6

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

      \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right) \cdot \frac{0.5}{a}} \]
      Proof
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (*.f64 c -4) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (*.f64 c (Rewrite<= metadata-eval (neg.f64 4))) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 c 4))) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (neg.f64 (Rewrite=> *-commutative_binary64 (*.f64 4 c))) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (fma.f64 a (Rewrite=> distribute-lft-neg-in_binary64 (*.f64 (neg.f64 4) c)) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 a (*.f64 (neg.f64 4) c)) (*.f64 b b)))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (+.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 a (neg.f64 4)) c)) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (+.f64 (*.f64 (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 a 4))) c) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (+.f64 (*.f64 (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 4 a))) c) (*.f64 b b))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 b b) (*.f64 (neg.f64 (*.f64 4 a)) c)))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 (sqrt.f64 (Rewrite<= cancel-sign-sub-inv_binary64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) b) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) (neg.f64 b))) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= +-commutative_binary64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 1/2 a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (/.f64 (Rewrite<= metadata-eval (/.f64 1 2)) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (/.f64 (/.f64 (Rewrite<= metadata-eval (neg.f64 -1)) 2) a)): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (Rewrite<= associate-/r*_binary64 (/.f64 (neg.f64 -1) (*.f64 2 a)))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (neg.f64 -1)) (*.f64 2 a))): 9 points increase in error, 13 points decrease in error
      (Rewrite=> associate-/l*_binary64 (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (/.f64 (*.f64 2 a) (neg.f64 -1)))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (/.f64 (*.f64 2 a) (Rewrite=> metadata-eval 1))): 0 points increase in error, 0 points decrease in error
      (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (Rewrite=> /-rgt-identity_binary64 (*.f64 2 a))): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in a around 0 5.8

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

      \[\leadsto \color{blue}{\frac{-c}{b}} \]
      Proof
      (/.f64 (neg.f64 c) b): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= mul-1-neg_binary64 (*.f64 -1 c)) b): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*r/_binary64 (*.f64 -1 (/.f64 c b))): 0 points increase in error, 0 points decrease in error
  3. Recombined 4 regimes into one program.
  4. Final simplification8.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{+126}:\\ \;\;\;\;\frac{b \cdot -2 + 2 \cdot \frac{c}{\frac{b}{a}}}{2 \cdot a}\\ \mathbf{elif}\;b \leq -6 \cdot 10^{-210}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{2 \cdot a}\\ \mathbf{elif}\;b \leq 4.8:\\ \;\;\;\;\frac{1}{\frac{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)}{\frac{c}{-0.5}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternatives

Alternative 1
Error11.2
Cost13896
\[\begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{+126}:\\ \;\;\;\;\frac{b \cdot -2 + 2 \cdot \frac{c}{\frac{b}{a}}}{2 \cdot a}\\ \mathbf{elif}\;b \leq 3.5:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 2
Error11.3
Cost7624
\[\begin{array}{l} \mathbf{if}\;b \leq -3.9 \cdot 10^{+119}:\\ \;\;\;\;\frac{b \cdot -2 + 2 \cdot \frac{c}{\frac{b}{a}}}{2 \cdot a}\\ \mathbf{elif}\;b \leq 7.8:\\ \;\;\;\;\left(\sqrt{b \cdot b + -4 \cdot \left(c \cdot a\right)} - b\right) \cdot \frac{0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 3
Error11.2
Cost7624
\[\begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{+126}:\\ \;\;\;\;\frac{b \cdot -2 + 2 \cdot \frac{c}{\frac{b}{a}}}{2 \cdot a}\\ \mathbf{elif}\;b \leq 8.2:\\ \;\;\;\;\frac{\sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 4
Error14.7
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -2.6 \cdot 10^{-115}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 2.4:\\ \;\;\;\;\frac{0.5}{a} \cdot \left(\sqrt{c \cdot \left(a \cdot -4\right)} - b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 5
Error22.3
Cost708
\[\begin{array}{l} \mathbf{if}\;b \leq -2.35 \cdot 10^{-199}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \end{array} \]
Alternative 6
Error22.1
Cost580
\[\begin{array}{l} \mathbf{if}\;b \leq -9 \cdot 10^{-304}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 7
Error39.6
Cost388
\[\begin{array}{l} \mathbf{if}\;b \leq 3.7 \cdot 10^{+77}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b}\\ \end{array} \]
Alternative 8
Error22.2
Cost388
\[\begin{array}{l} \mathbf{if}\;b \leq 2.8 \cdot 10^{-214}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 9
Error56.6
Cost192
\[\frac{c}{b} \]

Error

Reproduce

herbie shell --seed 2022332 
(FPCore (a b c)
  :name "Quadratic roots, full range"
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))