Average Error: 33.0 → 6.7
Time: 1.6m
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 -1.4471521473484649 \cdot 10^{+72}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\ \mathbf{if}\;b/2 \le -4.03008772537862 \cdot 10^{-252}:\\ \;\;\;\;\left(\sqrt[3]{\frac{c}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}} \cdot \sqrt[3]{\frac{c}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}\right) \cdot \sqrt[3]{\frac{c}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}\\ \mathbf{if}\;b/2 \le 1.1498155483847317 \cdot 10^{+81}:\\ \;\;\;\;\left(\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b/2}{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 < -1.4471521473484649e+72

    1. Initial program 57.3

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

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

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

    if -1.4471521473484649e+72 < b/2 < -4.03008772537862e-252

    1. Initial program 32.1

      \[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--32.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 simplify17.8

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt18.4

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

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

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

    if -4.03008772537862e-252 < b/2 < 1.1498155483847317e+81

    1. Initial program 8.8

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

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

    if 1.1498155483847317e+81 < b/2

    1. Initial program 41.1

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

      \[\leadsto \color{blue}{-2 \cdot \frac{b/2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 1.6m)Debug logProfile

herbie shell --seed '#(1063027428 1192549564 1443466578 604016274 3637110559 1698629644)' 
(FPCore (a b/2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))