Average Error: 33.2 → 9.3
Time: 58.0s
Precision: 64
Internal Precision: 128
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -6178373148497.949:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.4795847427363915 \cdot 10^{-113}:\\ \;\;\;\;\left(\sqrt[3]{\frac{1}{a}} \cdot \left(\left(c \cdot a\right) \cdot \sqrt[3]{\frac{1}{a}}\right)\right) \cdot \frac{\sqrt[3]{\frac{1}{a}}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le -8.195693387748483 \cdot 10^{-118}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.2345555440908271 \cdot 10^{+84}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{{b_2}^{2} - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -6178373148497.949 or -1.4795847427363915e-113 < b_2 < -8.195693387748483e-118

    1. Initial program 54.6

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

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

    if -6178373148497.949 < b_2 < -1.4795847427363915e-113

    1. Initial program 37.1

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied div-inv37.2

      \[\leadsto \frac{1}{\color{blue}{a \cdot \frac{1}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    6. Applied associate-/r*37.2

      \[\leadsto \color{blue}{\frac{\frac{1}{a}}{\frac{1}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    7. Using strategy rm
    8. Applied flip--37.2

      \[\leadsto \frac{\frac{1}{a}}{\frac{1}{\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}}}}}\]
    9. Applied associate-/r/37.3

      \[\leadsto \frac{\frac{1}{a}}{\color{blue}{\frac{1}{\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}} \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    10. Applied add-cube-cbrt37.6

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\frac{1}{a}}\right) \cdot \sqrt[3]{\frac{1}{a}}}}{\frac{1}{\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}} \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}\]
    11. Applied times-frac37.6

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\frac{1}{a}}}{\frac{1}{\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}}} \cdot \frac{\sqrt[3]{\frac{1}{a}}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    12. Simplified18.0

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{1}{a}} \cdot \left(\sqrt[3]{\frac{1}{a}} \cdot \left(a \cdot c\right)\right)\right)} \cdot \frac{\sqrt[3]{\frac{1}{a}}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    13. Simplified18.0

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

    if -8.195693387748483e-118 < b_2 < 1.2345555440908271e+84

    1. Initial program 11.8

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

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

    if 1.2345555440908271e+84 < b_2

    1. Initial program 43.5

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Taylor expanded around 0 4.4

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification9.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -6178373148497.949:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.4795847427363915 \cdot 10^{-113}:\\ \;\;\;\;\left(\sqrt[3]{\frac{1}{a}} \cdot \left(\left(c \cdot a\right) \cdot \sqrt[3]{\frac{1}{a}}\right)\right) \cdot \frac{\sqrt[3]{\frac{1}{a}}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le -8.195693387748483 \cdot 10^{-118}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.2345555440908271 \cdot 10^{+84}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{{b_2}^{2} - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \end{array}\]

Runtime

Time bar (total: 58.0s)Debug logProfile

herbie shell --seed 2018258 +o rules:numerics
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))