Average Error: 36.5 → 6.0
Time: 2.0m
Precision: 64
Internal precision: 2432
\[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -1.751131060884064 \cdot 10^{+136}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le 8.548826144111727 \cdot 10^{-60}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b/2 + \left(-b/2\right)}{a} - \frac{\frac{1}{2} \cdot c}{b/2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b/2

Bits error versus c

Derivation

  1. Split input into 3 regimes.
  2. if b/2 < -1.751131060884064e+136

    1. Initial program 56.2

      \[\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}}\]

    if -1.751131060884064e+136 < b/2 < 8.548826144111727e-60

    1. Initial program 12.5

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

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

    if 8.548826144111727e-60 < b/2

    1. Initial program 58.5

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

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

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

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

Runtime

Time bar (total: 2.0m) Debug log

Please include this information when filing a bug report:

herbie shell --seed '#(772101555 1905824529 294602591 2478279198 2123125427 4197813737)'
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))