Average Error: 35.6 → 6.3
Time: 15.5s
Precision: 64
Internal precision: 2944
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -41706129517399.03:\\ \;\;\;\;\frac{c}{\left(c \cdot \frac{1}{2}\right) \cdot \frac{a}{b/2} + \left(\left(-b/2\right) - b/2\right)}\\ \mathbf{if}\;b/2 \le -7.032654145395441 \cdot 10^{-187}:\\ \;\;\;\;\frac{\frac{c}{1} \cdot \frac{a}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}{a}\\ \mathbf{if}\;b/2 \le 3.713630071503827 \cdot 10^{+83}:\\ \;\;\;\;\left(\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{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 < -41706129517399.03

    1. Initial program 58.0

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

      \[\leadsto \frac{\color{blue}{\frac{{\left(-b/2\right)}^2 - {\left(\sqrt{{b/2}^2 - a \cdot c}\right)}^2}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}}{a}\]
    4. Applied simplify 31.4

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity 31.4

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{1 \cdot \left(\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}\right)}}}{a}\]
    7. Applied times-frac 32.9

      \[\leadsto \frac{\color{blue}{\frac{c}{1} \cdot \frac{a}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}}{a}\]
    8. Applied taylor 19.8

      \[\leadsto \frac{\frac{c}{1} \cdot \frac{a}{\left(-b/2\right) + \left(\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - b/2\right)}}{a}\]
    9. Taylor expanded around -inf 19.8

      \[\leadsto \frac{\frac{c}{1} \cdot \frac{a}{\left(-b/2\right) + \color{blue}{\left(\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - b/2\right)}}}{a}\]
    10. Applied simplify 2.1

      \[\leadsto \color{blue}{\frac{c}{\left(c \cdot \frac{1}{2}\right) \cdot \frac{a}{b/2} + \left(\left(-b/2\right) - b/2\right)}}\]

    if -41706129517399.03 < b/2 < -7.032654145395441e-187

    1. Initial program 32.2

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

      \[\leadsto \frac{\color{blue}{\frac{{\left(-b/2\right)}^2 - {\left(\sqrt{{b/2}^2 - a \cdot c}\right)}^2}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}}{a}\]
    4. Applied simplify 17.7

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity 17.7

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{1 \cdot \left(\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}\right)}}}{a}\]
    7. Applied times-frac 13.2

      \[\leadsto \frac{\color{blue}{\frac{c}{1} \cdot \frac{a}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}}{a}\]

    if -7.032654145395441e-187 < b/2 < 3.713630071503827e+83

    1. Initial program 10.7

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

      \[\leadsto \color{blue}{\left(\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}\right) \cdot \frac{1}{a}}\]

    if 3.713630071503827e+83 < b/2

    1. Initial program 44.5

      \[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Applied taylor 0

      \[\leadsto -2 \cdot \frac{b/2}{a}\]
    3. Taylor expanded around inf 0

      \[\leadsto \color{blue}{-2 \cdot \frac{b/2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 15.5s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1064875752 1442698706 3150723005 1316518582 2592983078 3835530843)'
(FPCore (a b/2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))