Average Error: 33.9 → 10.7
Time: 1.7m
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}\;\frac{\frac{-1}{2}}{b/2} \le -6.469709701552297 \cdot 10^{-73}:\\ \;\;\;\;\left(\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b/2} \le 4.329859948886553 \cdot 10^{-306}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{1}{2} - \frac{b/2}{a} \cdot 2\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b/2} \le 2.249078786618475 \cdot 10^{+154}:\\ \;\;\;\;\frac{c}{\frac{a \cdot \frac{1}{2}}{\frac{b/2}{c}} - \left(b/2 + b/2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b/2

Bits error versus c

Derivation

  1. Split input into 3 regimes
  2. if (/ -1/2 b/2) < -6.469709701552297e-73 or 2.249078786618475e+154 < (/ -1/2 b/2)

    1. Initial program 11.2

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

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

    if -6.469709701552297e-73 < (/ -1/2 b/2) < 4.329859948886553e-306

    1. Initial program 40.4

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

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

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

    if 4.329859948886553e-306 < (/ -1/2 b/2) < 2.249078786618475e+154

    1. Initial program 49.9

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

      \[\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 simplify24.9

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

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{\sqrt{b/2 \cdot b/2 - a \cdot c} - b/2}}}{a}\]
    6. Using strategy rm
    7. Applied clear-num25.1

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\frac{c \cdot a}{\sqrt{b/2 \cdot b/2 - a \cdot c} - b/2}}}}\]
    8. Taylor expanded around -inf 24.3

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

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

Runtime

Time bar (total: 1.7m)Debug logProfile

herbie shell --seed '#(1070991898 1055468627 4280279443 640792587 928206309 3646738750)' +o rules:numerics
(FPCore (a b/2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))