Average Error: 36.0 → 8.0
Time: 31.8s
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 -1.6024324632435378 \cdot 10^{+106}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le 1.0008229413212864 \cdot 10^{-23}:\\ \;\;\;\;\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\left(-b/2\right) - b/2\right) + \frac{c \cdot \frac{1}{2}}{\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 3 regimes.
  2. if b/2 < -1.6024324632435378e+106

    1. Initial program 48.3

      \[\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.6024324632435378e+106 < b/2 < 1.0008229413212864e-23

    1. Initial program 14.6

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

    if 1.0008229413212864e-23 < b/2

    1. Initial program 58.2

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

      \[\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 32.3

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

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

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

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

Runtime

Time bar (total: 31.8s) Debug log

Please include this information when filing a bug report:

herbie shell --seed '#(3283856077 3183919125 3399458751 396155847 3688194147 1862413033)'
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))