Average Error: 37.1 → 7.1
Time: 10.5s
Precision: 64
Internal precision: 2176
\[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -7.14895323289099 \cdot 10^{+145}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le 6.611638496230363 \cdot 10^{-143}:\\ \;\;\;\;\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\\ \mathbf{if}\;b/2 \le 2.353344202188118 \cdot 10^{-100}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\ \mathbf{if}\;b/2 \le 4.3383085193935005 \cdot 10^{-09}:\\ \;\;\;\;\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\\ \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 5 regimes.
  2. if b/2 < -7.14895323289099e+145

    1. Initial program 58.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 -7.14895323289099e+145 < b/2 < 6.611638496230363e-143

    1. Initial program 10.9

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

    if 6.611638496230363e-143 < b/2 < 2.353344202188118e-100

    1. Initial program 61.1

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

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

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

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

    if 2.353344202188118e-100 < b/2 < 4.3383085193935005e-09

    1. Initial program 37.3

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

    if 4.3383085193935005e-09 < b/2

    1. Initial program 58.1

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

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

      \[\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 5 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 10.5s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1067773715 2765207660 218871639 3688798924 2755544087 2054563380)'
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))