Average Error: 33.4 → 16.0
Time: 3.7m
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.335093396160859 \cdot 10^{+154}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 1.6229091177296145 \cdot 10^{-140}:\\ \;\;\;\;\frac{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}{2 \cdot a} - \frac{b}{2 \cdot a}\\ \mathbf{if}\;b \le 3741376019305.5195:\\ \;\;\;\;\log_* (1 + (e^{\frac{\left(4 \cdot \left(-c\right)\right) \cdot \frac{1}{2}}{\sqrt{(\left(-c\right) \cdot \left(4 \cdot a\right) + \left(b \cdot b\right))_*} + b}} - 1)^*)\\ \mathbf{else}:\\ \;\;\;\;\frac{-4}{2} \cdot \frac{c}{b + b}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b < -1.335093396160859e+154

    1. Initial program 60.9

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

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{b}{a}}\]

    if -1.335093396160859e+154 < b < 1.6229091177296145e-140

    1. Initial program 10.9

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

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

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

    if 1.6229091177296145e-140 < b < 3741376019305.5195

    1. Initial program 34.8

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

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

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

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

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

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

    if 3741376019305.5195 < b

    1. Initial program 54.9

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(a \cdot c\right) \cdot \frac{-4}{\color{blue}{b} + b}}{2 \cdot a}\]
    11. Applied simplify6.1

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

Runtime

Time bar (total: 3.7m)Debug logProfile

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