Average Error: 33.2 → 6.9
Time: 29.3s
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 -3.358464630654013 \cdot 10^{+156}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.257641725171672 \cdot 10^{-275}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) + \sqrt{{b_2}^{2} - c \cdot a}}\\ \mathbf{elif}\;b_2 \le 6.968069571359454 \cdot 10^{+72}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{{b_2}^{2} - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \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 < -3.358464630654013e+156

    1. Initial program 62.9

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} - a \cdot c}}}{a}\]
    3. Using strategy rm
    4. Applied div-inv62.9

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{{b_2}^{2} - a \cdot c}\right) \cdot \frac{1}{a}}\]
    5. Taylor expanded around -inf 1.1

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

    if -3.358464630654013e+156 < b_2 < 1.257641725171672e-275

    1. Initial program 33.3

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

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

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{{b_2}^{2} - a \cdot c}\right) \cdot \frac{1}{a}}\]
    5. Using strategy rm
    6. Applied flip--33.4

      \[\leadsto \color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{{b_2}^{2} - a \cdot c} \cdot \sqrt{{b_2}^{2} - a \cdot c}}{\left(-b_2\right) + \sqrt{{b_2}^{2} - a \cdot c}}} \cdot \frac{1}{a}\]
    7. Applied associate-*l/33.5

      \[\leadsto \color{blue}{\frac{\left(\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{{b_2}^{2} - a \cdot c} \cdot \sqrt{{b_2}^{2} - a \cdot c}\right) \cdot \frac{1}{a}}{\left(-b_2\right) + \sqrt{{b_2}^{2} - a \cdot c}}}\]
    8. Simplified14.5

      \[\leadsto \frac{\color{blue}{\frac{0 + a \cdot c}{a}}}{\left(-b_2\right) + \sqrt{{b_2}^{2} - a \cdot c}}\]
    9. Taylor expanded around inf 9.1

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

    if 1.257641725171672e-275 < b_2 < 6.968069571359454e+72

    1. Initial program 8.9

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

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

    if 6.968069571359454e+72 < b_2

    1. Initial program 38.9

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} - a \cdot c}}}{a}\]
    3. Using strategy rm
    4. Applied div-inv39.0

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{{b_2}^{2} - a \cdot c}\right) \cdot \frac{1}{a}}\]
    5. Taylor expanded around inf 4.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.358464630654013 \cdot 10^{+156}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.257641725171672 \cdot 10^{-275}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) + \sqrt{{b_2}^{2} - c \cdot a}}\\ \mathbf{elif}\;b_2 \le 6.968069571359454 \cdot 10^{+72}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{{b_2}^{2} - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \end{array}\]

Runtime

Time bar (total: 29.3s)Debug logProfile

herbie shell --seed 2018349 
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))