Average Error: 33.8 → 10.9
Time: 24.0s
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 -57459156251081.02:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 8.238059268829752 \cdot 10^{-48}:\\ \;\;\;\;\frac{1}{\frac{1}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{-2 \cdot \frac{b_2}{c}}\\ \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 3 regimes
  2. if b_2 < -57459156251081.02

    1. Initial program 31.7

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification31.7

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied fma-neg31.7

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

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

    if -57459156251081.02 < b_2 < 8.238059268829752e-48

    1. Initial program 15.5

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied clear-num15.6

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    5. Using strategy rm
    6. Applied div-inv15.6

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

    if 8.238059268829752e-48 < b_2

    1. Initial program 53.8

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification53.8

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied clear-num53.8

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    5. Using strategy rm
    6. Applied div-inv53.8

      \[\leadsto \frac{1}{\color{blue}{a \cdot \frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    7. Taylor expanded around 0 8.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -57459156251081.02:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 8.238059268829752 \cdot 10^{-48}:\\ \;\;\;\;\frac{1}{\frac{1}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{-2 \cdot \frac{b_2}{c}}\\ \end{array}\]

Runtime

Time bar (total: 24.0s)Debug logProfile

herbie shell --seed 2018248 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))