Average Error: 33.1 → 9.4
Time: 1.7m
Precision: 64
Internal Precision: 3392
\[\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 -718312294.6999037:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right) \cdot \frac{1}{a}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le -1.812197585128254 \cdot 10^{-307}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le 1.2662474311558236 \cdot 10^{+22}:\\ \;\;\;\;\frac{c}{b_2} \cdot \left(-\frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}} \cdot \frac{a}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}}{a}\\ \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 (/ -1/2 b_2) < -718312294.6999037

    1. Initial program 11.1

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

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

    if -718312294.6999037 < (/ -1/2 b_2) < -1.812197585128254e-307

    1. Initial program 29.1

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

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

    if -1.812197585128254e-307 < (/ -1/2 b_2) < 1.2662474311558236e+22

    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 46.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.8

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

    if 1.2662474311558236e+22 < (/ -1/2 b_2)

    1. Initial program 22.6

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

      \[\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 simplify15.7

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

      \[\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 add-cube-cbrt16.5

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{\left(\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\right) \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\]
    8. Applied times-frac13.6

      \[\leadsto \frac{\color{blue}{\frac{c}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify9.4

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le -718312294.6999037:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right) \cdot \frac{1}{a}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le -1.812197585128254 \cdot 10^{-307}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le 1.2662474311558236 \cdot 10^{+22}:\\ \;\;\;\;\frac{c}{b_2} \cdot \left(-\frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}} \cdot \frac{a}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}}{a}\\ \end{array}}\]

Runtime

Time bar (total: 1.7m)Debug logProfile

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