Average Error: 36.7 → 6.1
Time: 43.7s
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 -5.224339320607286 \cdot 10^{+142}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le 5.922881749075492 \cdot 10^{-58}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{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 < -5.224339320607286e+142

    1. Initial program 57.7

      \[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/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 -5.224339320607286e+142 < b/2 < 5.922881749075492e-58

    1. Initial program 12.7

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

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

    if 5.922881749075492e-58 < b/2

    1. Initial program 58.9

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

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

      \[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{c \cdot a}{b/2}}}{a}\]
    4. Applied simplify 0.0

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

Runtime

Time bar (total: 43.7s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1068028399 4028058041 2917032441 2563479541 765645300 1132738916)'
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))