Average Error: 33.5 → 8.7
Time: 1.1m
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}\;\frac{b/2}{\frac{-1}{2}} \le -1.6235218796778434 \cdot 10^{+122}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{1}{2} - \frac{b/2}{a} \cdot 2\\ \mathbf{if}\;\frac{b/2}{\frac{-1}{2}} \le 1.651693761009362 \cdot 10^{-109}:\\ \;\;\;\;\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\\ \mathbf{if}\;\frac{b/2}{\frac{-1}{2}} \le 1.7864164811458678 \cdot 10^{+34}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\sqrt{b/2 \cdot b/2 - a \cdot c} - b/2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{b/2}{\frac{-1}{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 -1/2) < -1.6235218796778434e+122

    1. Initial program 50.7

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

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

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

    if -1.6235218796778434e+122 < (/ b/2 -1/2) < 1.651693761009362e-109

    1. Initial program 11.5

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

    if 1.651693761009362e-109 < (/ b/2 -1/2) < 1.7864164811458678e+34

    1. Initial program 38.8

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

      \[\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 simplify16.5

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

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

    if 1.7864164811458678e+34 < (/ b/2 -1/2)

    1. Initial program 56.4

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

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

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

Runtime

Time bar (total: 1.1m)Debug logProfile

herbie shell --seed '#(1070386091 2509006183 1430610344 1025408621 36622005 1425925650)' +o rules:numerics
(FPCore (a b/2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))