Average Error: 33.5 → 22.6
Time: 18.3s
Precision: 64
Internal Precision: 128
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le 6.566052412663842 \cdot 10^{-142}:\\ \;\;\;\;\frac{(\left(\sqrt{\sqrt{(a \cdot \left(c \cdot -4\right) + \left(b \cdot b\right))_*}}\right) \cdot \left(\sqrt{\sqrt{(a \cdot \left(c \cdot -4\right) + \left(b \cdot b\right))_*}}\right) + \left(-b\right))_*}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(a \cdot -4\right) \cdot c}{\left(b + \sqrt{(\left(a \cdot -4\right) \cdot c + \left(b \cdot b\right))_*}\right) \cdot \left(a \cdot 2\right)}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 2 regimes
  2. if b < 6.566052412663842e-142

    1. Initial program 20.5

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

      \[\leadsto \color{blue}{\frac{\sqrt{(\left(a \cdot -4\right) \cdot c + \left(b \cdot b\right))_*} - b}{2 \cdot a}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity20.5

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

      \[\leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\sqrt{(\left(a \cdot -4\right) \cdot c + \left(b \cdot b\right))_*} - b}}}\]
    6. Using strategy rm
    7. Applied associate-/r/20.6

      \[\leadsto \color{blue}{\frac{1}{2 \cdot a} \cdot \left(\sqrt{(\left(a \cdot -4\right) \cdot c + \left(b \cdot b\right))_*} - b\right)}\]
    8. Using strategy rm
    9. Applied associate-*l/20.5

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

      \[\leadsto \frac{\color{blue}{\sqrt{(a \cdot \left(c \cdot -4\right) + \left(b \cdot b\right))_*} - b}}{2 \cdot a}\]
    11. Using strategy rm
    12. Applied add-sqr-sqrt20.6

      \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{(a \cdot \left(c \cdot -4\right) + \left(b \cdot b\right))_*}} \cdot \sqrt{\sqrt{(a \cdot \left(c \cdot -4\right) + \left(b \cdot b\right))_*}}} - b}{2 \cdot a}\]
    13. Applied fma-neg20.6

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

    if 6.566052412663842e-142 < b

    1. Initial program 49.7

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

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

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

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

      \[\leadsto \frac{\color{blue}{\left(a \cdot -4\right) \cdot c}}{\left(2 \cdot a\right) \cdot \left(\sqrt{(\left(a \cdot -4\right) \cdot c + \left(b \cdot b\right))_*} + b\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification22.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 6.566052412663842 \cdot 10^{-142}:\\ \;\;\;\;\frac{(\left(\sqrt{\sqrt{(a \cdot \left(c \cdot -4\right) + \left(b \cdot b\right))_*}}\right) \cdot \left(\sqrt{\sqrt{(a \cdot \left(c \cdot -4\right) + \left(b \cdot b\right))_*}}\right) + \left(-b\right))_*}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(a \cdot -4\right) \cdot c}{\left(b + \sqrt{(\left(a \cdot -4\right) \cdot c + \left(b \cdot b\right))_*}\right) \cdot \left(a \cdot 2\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2019030 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, full range"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))