Average Error: 35.0 → 6.3
Time: 31.9s
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 -6.5699153576604614 \cdot 10^{+97}:\\ \;\;\;\;\frac{c}{\frac{b/2}{\frac{1}{2}}} - \frac{b/2 + b/2}{a}\\ \mathbf{if}\;b/2 \le -3.283746017650344 \cdot 10^{-287}:\\ \;\;\;\;\left(\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{if}\;b/2 \le 2.9567149947595096 \cdot 10^{+19}:\\ \;\;\;\;\frac{\frac{a \cdot c}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b/2 + \left(-b/2\right)}{a} - \frac{\frac{1}{2} \cdot c}{b/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 < -6.5699153576604614e+97

    1. Initial program 46.8

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

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

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

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

    if -6.5699153576604614e+97 < b/2 < -3.283746017650344e-287

    1. Initial program 8.7

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

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

    if -3.283746017650344e-287 < b/2 < 2.9567149947595096e+19

    1. Initial program 25.6

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

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

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

    if 2.9567149947595096e+19 < b/2

    1. Initial program 58.0

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

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

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

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

Runtime

Time bar (total: 31.9s) Debug log

Please include this information when filing a bug report:

herbie shell --seed '#(2277612311 2645429965 1090895633 2857793080 2144184008 3989768357)'
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))