Average Error: 34.7 → 9.9
Time: 1.1m
Precision: 64
Ground Truth: 128
\[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -3.2345120336434788 \cdot 10^{+106}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le 1.135484290896535 \cdot 10^{-164}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}\\ \mathbf{if}\;b/2 \le 4.966247580688122 \cdot 10^{+78}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(-b/2\right) + b/2\right) - \frac{c}{b/2} \cdot \left(a \cdot \frac{1}{2}\right)}{a}\\ \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 < -3.2345120336434788e+106

    1. Initial program 48.1

      \[\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 -3.2345120336434788e+106 < b/2 < 1.135484290896535e-164

    1. Initial program 11.2

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

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

    if 1.135484290896535e-164 < b/2 < 4.966247580688122e+78

    1. Initial program 37.4

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

      \[\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.1

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

    if 4.966247580688122e+78 < b/2

    1. Initial program 58.6

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

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

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

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

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

Runtime

Total time: 1.1m Debug log

Please include this information when filing a bug report:

herbie --seed '#(1159182669 2372458198 2796218637 1211671712 742930139 482703909)'
(FPCore (a b/2 c)
  :name "NMSE problem 3.2.1, positive"
  (/ (+ (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))