Average Error: 52.6 → 0.1
Time: 4.6s
Precision: binary64
\[4.93038 \cdot 10^{-32} \lt a \lt 2.02824 \cdot 10^{31} \land 4.93038 \cdot 10^{-32} \lt b \lt 2.02824 \cdot 10^{31} \land 4.93038 \cdot 10^{-32} \lt c \lt 2.02824 \cdot 10^{31}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[4 \cdot \frac{-c}{\left(b + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right) \cdot 2}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 52.6

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

    \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}}\]
  3. Using strategy rm
  4. Applied flip--52.6

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

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

    \[\leadsto \frac{\frac{0 - 4 \cdot \left(a \cdot c\right)}{\color{blue}{b + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}}{a \cdot 2}\]
  7. Using strategy rm
  8. Applied div-inv0.4

    \[\leadsto \frac{\color{blue}{\left(0 - 4 \cdot \left(a \cdot c\right)\right) \cdot \frac{1}{b + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}}{a \cdot 2}\]
  9. Applied associate-/l*0.5

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

    \[\leadsto \frac{0 - 4 \cdot \left(a \cdot c\right)}{\color{blue}{a \cdot \left(\left(b + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right) \cdot 2\right)}}\]
  11. Using strategy rm
  12. Applied sub0-neg0.4

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

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

    \[\leadsto -\color{blue}{\frac{4}{1 \cdot \frac{\left(b + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right) \cdot 2}{c}}}\]
  15. Using strategy rm
  16. Applied div-inv0.3

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

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

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

Reproduce

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