Average Error: 36.8 → 6.4
Time: 14.2s
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.5852813649951211 \cdot 10^{+33}:\\ \;\;\;\;\frac{\frac{c}{b/2} \cdot \left(a \cdot \frac{1}{2}\right) - \left(b/2 - \left(-b/2\right)\right)}{a}\\ \mathbf{if}\;b/2 \le 5.3630996565742086 \cdot 10^{-235}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}\\ \mathbf{if}\;b/2 \le 1.6164635363498484 \cdot 10^{-18}:\\ \;\;\;\;\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 < -1.5852813649951211e+33

    1. Initial program 38.4

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

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

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

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

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

    if -1.5852813649951211e+33 < b/2 < 5.3630996565742086e-235

    1. Initial program 11.3

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

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

    if 5.3630996565742086e-235 < b/2 < 1.6164635363498484e-18

    1. Initial program 26.8

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

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

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

    if 1.6164635363498484e-18 < b/2

    1. Initial program 57.9

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

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

      \[\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: 14.2s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1064555532 179913862 452496668 2441903500 287849034 462453547)'
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))