Average Error: 33.3 → 9.6
Time: 35.1s
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 -1.6346386267445324 \cdot 10^{+148}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b_2 \le 2.597338060915838 \cdot 10^{-118}:\\ \;\;\;\;\frac{\sqrt{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}{\frac{a}{\sqrt{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}}\\ \mathbf{elif}\;b_2 \le 8.223224392443658 \cdot 10^{+67}:\\ \;\;\;\;\frac{\left(-c\right) \cdot a}{a \cdot \left(\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -1.6346386267445324e+148

    1. Initial program 58.3

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Taylor expanded around -inf 2.5

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}}\]
    4. Simplified2.5

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

    if -1.6346386267445324e+148 < b_2 < 2.597338060915838e-118

    1. Initial program 11.1

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt11.5

      \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    5. Applied associate-/l*11.5

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

    if 2.597338060915838e-118 < b_2 < 8.223224392443658e+67

    1. Initial program 39.1

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

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

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - b_2 \cdot b_2}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}}}{a}\]
    5. Applied associate-/l/42.3

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

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

    if 8.223224392443658e+67 < b_2

    1. Initial program 57.7

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Taylor expanded around inf 3.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.6346386267445324 \cdot 10^{+148}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b_2 \le 2.597338060915838 \cdot 10^{-118}:\\ \;\;\;\;\frac{\sqrt{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}{\frac{a}{\sqrt{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}}\\ \mathbf{elif}\;b_2 \le 8.223224392443658 \cdot 10^{+67}:\\ \;\;\;\;\frac{\left(-c\right) \cdot a}{a \cdot \left(\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Runtime

Time bar (total: 35.1s)Debug logProfile

herbie shell --seed 2018258 +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))