Average Error: 33.3 → 8.9
Time: 1.4m
Precision: 64
Internal Precision: 3456
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -2.2811085561893518 \cdot 10^{-11}:\\ \;\;\;\;\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}\\ \mathbf{if}\;b_2 \le -5.758600269889299 \cdot 10^{-250}:\\ \;\;\;\;\frac{\frac{a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\\ \mathbf{if}\;b_2 \le 2.1163211128201421 \cdot 10^{+74}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot \frac{1}{2}}{\frac{b_2}{c}} - \left(b_2 + b_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 < -2.2811085561893518e-11

    1. Initial program 54.7

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

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{\left(\frac{1}{2} \cdot \frac{c \cdot a}{b_2} - b_2\right)}}{a}\]
    3. Applied simplify6.1

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

    if -2.2811085561893518e-11 < b_2 < -5.758600269889299e-250

    1. Initial program 27.3

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

      \[\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 simplify17.6

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Applied simplify17.6

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]

    if -5.758600269889299e-250 < b_2 < 2.1163211128201421e+74

    1. Initial program 9.6

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num9.7

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

    if 2.1163211128201421e+74 < b_2

    1. Initial program 39.2

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

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{\left(b_2 - \frac{1}{2} \cdot \frac{c \cdot a}{b_2}\right)}}{a}\]
    3. Applied simplify5.0

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{2} \cdot a}{\frac{b_2}{c}} - \left(b_2 + b_2\right)}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify8.9

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b_2 \le -2.2811085561893518 \cdot 10^{-11}:\\ \;\;\;\;\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}\\ \mathbf{if}\;b_2 \le -5.758600269889299 \cdot 10^{-250}:\\ \;\;\;\;\frac{\frac{a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\\ \mathbf{if}\;b_2 \le 2.1163211128201421 \cdot 10^{+74}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot \frac{1}{2}}{\frac{b_2}{c}} - \left(b_2 + b_2\right)}{a}\\ \end{array}}\]

Runtime

Time bar (total: 1.4m)Debug logProfile

herbie shell --seed '#(1070960995 739739648 2531964651 3069671617 351857262 3877178482)' +o rules:numerics
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))