Average Error: 32.9 → 13.2
Time: 21.6s
Precision: 64
Internal Precision: 3136
\[\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 7.828188602121871 \cdot 10^{-261}:\\ \;\;\;\;\frac{\sqrt{(\left(a \cdot -4\right) \cdot c + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\ \mathbf{elif}\;b \le 7.867015178186245 \cdot 10^{+153}:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{(\left(a \cdot -4\right) \cdot c + \left(b \cdot b\right))_*}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{-\frac{b}{c}}\\ \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 < 7.828188602121871e-261

    1. Initial program 20.6

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

      \[\leadsto \frac{\sqrt{(\left(a \cdot -4\right) \cdot c + \left(b \cdot b\right))_*} - b}{2 \cdot a}\]
    3. Taylor expanded around inf 20.6

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

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

    if 7.828188602121871e-261 < b < 7.867015178186245e+153

    1. Initial program 35.7

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

      \[\leadsto \frac{\sqrt{(\left(a \cdot -4\right) \cdot c + \left(b \cdot b\right))_*} - b}{2 \cdot a}\]
    3. Taylor expanded around inf 35.7

      \[\leadsto \frac{\sqrt{\color{blue}{{b}^{2} - 4 \cdot \left(a \cdot c\right)}} - b}{2 \cdot a}\]
    4. Simplified35.7

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

      \[\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}\]
    7. Applied associate-/l/39.9

      \[\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)}}\]
    8. Simplified19.5

      \[\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)}\]
    9. Using strategy rm
    10. Applied times-frac7.7

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

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

    if 7.867015178186245e+153 < b

    1. Initial program 62.8

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

      \[\leadsto \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-identity62.9

      \[\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*62.9

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

      \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c}}}\]
    7. Simplified2.2

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

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

Runtime

Time bar (total: 21.6s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes29.613.212.617.196.5%
herbie shell --seed 2018340 +o rules:numerics
(FPCore (a b c)
  :name "Quadratic roots, full range"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))