Average Error: 38.6 → 4.0
Time: 1.7m
Precision: 64
Internal Precision: 3200
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -6.539512710864403 \cdot 10^{+66}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\ \mathbf{if}\;b/2 \le -3.4571144459829794 \cdot 10^{-131}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\ \mathbf{if}\;b/2 \le 3.1746500024866854 \cdot 10^{+75}:\\ \;\;\;\;\frac{-b/2}{a} - \frac{\sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b/2} + \frac{\left(-b/2\right) - b/2}{a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b/2

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b/2 < -6.539512710864403e+66

    1. Initial program 58.2

      \[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 14.5

      \[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{c \cdot a}{b/2}}}{a}\]
    3. Applied simplify0.0

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

    if -6.539512710864403e+66 < b/2 < -3.4571144459829794e-131

    1. Initial program 59.8

      \[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 16.1

      \[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{c \cdot a}{b/2}}}{a}\]
    3. Applied simplify0.0

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

    if -3.4571144459829794e-131 < b/2 < 3.1746500024866854e+75

    1. Initial program 11.1

      \[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied div-sub11.1

      \[\leadsto \color{blue}{\frac{-b/2}{a} - \frac{\sqrt{b/2 \cdot b/2 - a \cdot c}}{a}}\]

    if 3.1746500024866854e+75 < b/2

    1. Initial program 41.9

      \[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num42.0

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}}\]
    4. Taylor expanded around inf 12.3

      \[\leadsto \frac{1}{\frac{a}{\left(-b/2\right) - \color{blue}{\left(b/2 - \frac{1}{2} \cdot \frac{c \cdot a}{b/2}\right)}}}\]
    5. Applied simplify0.0

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b/2} + \frac{\left(-b/2\right) - b/2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 1.7m)Debug logProfile

herbie shell --seed '#(1062930989 876886121 3990119081 3032829768 3060892583 1929069376)' 
(FPCore (a b/2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))