Average Error: 33.7 → 6.9
Time: 59.7s
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}\;b_2 \le -1.6297109865612804 \cdot 10^{+100}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.8432230948847296 \cdot 10^{-227}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 1.1804780135031518 \cdot 10^{+86}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{{b_2}^{2} - a \cdot c}}{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

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 < -1.6297109865612804e+100

    1. Initial program 58.5

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification58.5

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied div-inv58.5

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

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

    if -1.6297109865612804e+100 < b_2 < 1.8432230948847296e-227

    1. Initial program 30.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification30.1

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

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

      \[\leadsto \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}}} \cdot \frac{1}{a}\]
    7. Applied associate-*l/30.4

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

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

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

    if 1.8432230948847296e-227 < b_2 < 1.1804780135031518e+86

    1. Initial program 8.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification8.1

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

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

    if 1.1804780135031518e+86 < b_2

    1. Initial program 42.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification42.1

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

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

      \[\leadsto \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}}} \cdot \frac{1}{a}\]
    7. Applied associate-*l/61.1

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

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

      \[\leadsto \color{blue}{-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 -1.6297109865612804 \cdot 10^{+100}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.8432230948847296 \cdot 10^{-227}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 1.1804780135031518 \cdot 10^{+86}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{{b_2}^{2} - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Runtime

Time bar (total: 59.7s)Debug logProfile

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