Average Error: 52.8 → 1.4
Time: 6.3s
Precision: binary64
\[\left(\left(4.930380657631324 \cdot 10^{-32} < a \land a < 2.028240960365167 \cdot 10^{+31}\right) \land \left(4.930380657631324 \cdot 10^{-32} < b \land b < 2.028240960365167 \cdot 10^{+31}\right)\right) \land \left(4.930380657631324 \cdot 10^{-32} < c \land c < 2.028240960365167 \cdot 10^{+31}\right)\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
\[-2 \cdot \frac{\left(a \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \mathsf{fma}\left(5, \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}}, \mathsf{fma}\left(\frac{c \cdot c}{{b}^{3}}, a, \frac{c}{b}\right)\right) \]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
-2 \cdot \frac{\left(a \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \mathsf{fma}\left(5, \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}}, \mathsf{fma}\left(\frac{c \cdot c}{{b}^{3}}, a, \frac{c}{b}\right)\right)
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (a b c)
 :precision binary64
 (-
  (* -2.0 (/ (* (* a a) (pow c 3.0)) (pow b 5.0)))
  (fma
   5.0
   (/ (* (pow a 3.0) (pow c 4.0)) (pow b 7.0))
   (fma (/ (* c c) (pow b 3.0)) a (/ 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) {
	return (-2.0 * (((a * a) * pow(c, 3.0)) / pow(b, 5.0))) - fma(5.0, ((pow(a, 3.0) * pow(c, 4.0)) / pow(b, 7.0)), fma(((c * c) / pow(b, 3.0)), a, (c / b)));
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 52.8

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

    \[\leadsto \frac{\left(-\color{blue}{\sqrt{b} \cdot \sqrt{b}}\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  3. Applied distribute-rgt-neg-in_binary6452.6

    \[\leadsto \frac{\color{blue}{\sqrt{b} \cdot \left(-\sqrt{b}\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  4. Applied fma-def_binary6452.0

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

    \[\leadsto \color{blue}{-\left(2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(5 \cdot \frac{{c}^{4} \cdot {a}^{3}}{{b}^{7}} + \left(\frac{{c}^{2} \cdot a}{{b}^{3}} + \frac{c}{b}\right)\right)\right)} \]
  6. Simplified1.4

    \[\leadsto \color{blue}{-2 \cdot \frac{\left(a \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \mathsf{fma}\left(5, \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}}, \mathsf{fma}\left(\frac{c \cdot c}{{b}^{3}}, a, \frac{c}{b}\right)\right)} \]
  7. Final simplification1.4

    \[\leadsto -2 \cdot \frac{\left(a \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \mathsf{fma}\left(5, \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}}, \mathsf{fma}\left(\frac{c \cdot c}{{b}^{3}}, a, \frac{c}{b}\right)\right) \]

Reproduce

herbie shell --seed 2022077 
(FPCore (a b c)
  :name "Quadratic roots, wide range"
  :precision binary64
  :pre (and (and (and (< 4.930380657631324e-32 a) (< a 2.028240960365167e+31)) (and (< 4.930380657631324e-32 b) (< b 2.028240960365167e+31))) (and (< 4.930380657631324e-32 c) (< c 2.028240960365167e+31)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))