Average Error: 32.9 → 8.3
Time: 1.4m
Precision: 64
Internal Precision: 3200
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -8.541856046995584 \cdot 10^{+69}:\\ \;\;\;\;\frac{c}{\frac{b/2}{\frac{-1}{2}}}\\ \mathbf{if}\;b/2 \le -5.366872899550683 \cdot 10^{-159}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\sqrt{b/2 \cdot b/2 - a \cdot c} - b/2}}{a}\\ \mathbf{if}\;b/2 \le 3.0192952941142363 \cdot 10^{+105}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{1}{2} - \frac{b/2}{a} \cdot 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 < -8.541856046995584e+69

    1. Initial program 57.2

      \[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 14.3

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

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

    if -8.541856046995584e+69 < b/2 < -5.366872899550683e-159

    1. Initial program 36.2

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

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

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

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

    if -5.366872899550683e-159 < b/2 < 3.0192952941142363e+105

    1. Initial program 10.1

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

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

    if 3.0192952941142363e+105 < b/2

    1. Initial program 46.6

      \[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Taylor expanded around inf 9.8

      \[\leadsto \frac{\color{blue}{\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - 2 \cdot b/2}}{a}\]
    3. Applied simplify3.6

      \[\leadsto \color{blue}{\frac{c}{b/2} \cdot \frac{1}{2} - \frac{b/2}{a} \cdot 2}\]
  3. Recombined 4 regimes into one program.

Runtime

Time bar (total: 1.4m)Debug logProfile

herbie shell --seed '#(1070833653 108281690 3330367898 3632331308 3494323072 43156186)' +o rules:numerics
(FPCore (a b/2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))