Average Error: 52.6 → 0.3
Time: 4.9s
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}\]
\[\left(4 \cdot c\right) \cdot \frac{1}{\left(\left(-b\right) - \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 frac-2neg0.4

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

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

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

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

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

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

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

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

Reproduce

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