Average Error: 33.6 → 14.8
Time: 2.6m
Precision: 64
Internal Precision: 3392
\[\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 1.462694653729055 \cdot 10^{-262}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \mathbf{if}\;b \le 4.663724532184832 \cdot 10^{+112}:\\ \;\;\;\;\frac{a \cdot \frac{-4 \cdot c}{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} + b}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{2 \cdot a} \cdot \frac{\frac{c}{\frac{-1}{2}}}{b}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 3 regimes
  2. if b < 1.462694653729055e-262

    1. Initial program 21.1

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

    if 1.462694653729055e-262 < b < 4.663724532184832e+112

    1. Initial program 34.6

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

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

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

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

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

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

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

    if 4.663724532184832e+112 < b

    1. Initial program 59.6

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{a \cdot \left(-4 \cdot c\right)}}{\sqrt{(c \cdot \left(-4 \cdot a\right) + \left(b \cdot b\right))_*} + b}}{2 \cdot a}\]
    6. Taylor expanded around 0 13.6

      \[\leadsto \frac{\frac{a \cdot \left(-4 \cdot c\right)}{\color{blue}{2 \cdot b}}}{2 \cdot a}\]
    7. Applied simplify2.5

      \[\leadsto \color{blue}{\frac{a}{2 \cdot a} \cdot \frac{\frac{c}{\frac{-1}{2}}}{b}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 2.6m)Debug logProfile

herbie shell --seed '#(1071373924 2949776965 1885069702 3247780810 90874544 2263903749)' +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, full range"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))