Average Error: 33.9 → 8.2
Time: 13.6s
Precision: 64
Internal precision: 3200
\[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -2.6651045154090737 \cdot 10^{+129}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b/2} - 2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le 2.1282955610931867 \cdot 10^{-170}:\\ \;\;\;\;\left(\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{if}\;b/2 \le 4.513700515120415 \cdot 10^{+116}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\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 4 regimes.
  2. if b/2 < -2.6651045154090737e+129

    1. Initial program 53.4

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

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

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

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

    if -2.6651045154090737e+129 < b/2 < 2.1282955610931867e-170

    1. Initial program 11.0

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

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

    if 2.1282955610931867e-170 < b/2 < 4.513700515120415e+116

    1. Initial program 37.3

      \[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-+ 37.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 15.4

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

    if 4.513700515120415e+116 < b/2

    1. Initial program 60.5

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

Runtime

Time bar (total: 13.6s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1065033997 2389885643 4100569014 2620012693 26800780 3144211646)'
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))