Average Error: 33.2 → 12.4
Time: 27.5s
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 -3.5692996466264766 \cdot 10^{+148}:\\ \;\;\;\;\frac{-2 \cdot b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.83030392761771 \cdot 10^{-133}:\\ \;\;\;\;\frac{\sqrt{(b_2 \cdot b_2 + \left(a \cdot \left(-c\right)\right))_*} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 5.2948860561332035 \cdot 10^{+135}:\\ \;\;\;\;\frac{\frac{a \cdot \left(-c\right)}{e^{\log \left(\sqrt{(b_2 \cdot b_2 + \left(a \cdot \left(-c\right)\right))_*} + b_2\right)}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot \frac{c \cdot a}{b_2}}{a}\\ \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 < -3.5692996466264766e+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. Using strategy rm
    4. Applied fma-neg58.3

      \[\leadsto \frac{\sqrt{\color{blue}{(b_2 \cdot b_2 + \left(-a \cdot c\right))_*}} - b_2}{a}\]
    5. Using strategy rm
    6. Applied add-exp-log58.5

      \[\leadsto \frac{\color{blue}{e^{\log \left(\sqrt{(b_2 \cdot b_2 + \left(-a \cdot c\right))_*} - b_2\right)}}}{a}\]
    7. Taylor expanded around -inf 9.3

      \[\leadsto \frac{\color{blue}{e^{\log 2 - \log \left(\frac{-1}{b_2}\right)}}}{a}\]
    8. Simplified2.5

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

    if -3.5692996466264766e+148 < b_2 < 1.83030392761771e-133

    1. Initial program 10.6

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

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

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

    if 1.83030392761771e-133 < b_2 < 5.2948860561332035e+135

    1. Initial program 41.7

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{(b_2 \cdot b_2 + \left(-a \cdot c\right))_*}} - b_2}{a}\]
    5. Using strategy rm
    6. Applied add-exp-log43.2

      \[\leadsto \frac{\color{blue}{e^{\log \left(\sqrt{(b_2 \cdot b_2 + \left(-a \cdot c\right))_*} - b_2\right)}}}{a}\]
    7. Using strategy rm
    8. Applied flip--43.3

      \[\leadsto \frac{e^{\log \color{blue}{\left(\frac{\sqrt{(b_2 \cdot b_2 + \left(-a \cdot c\right))_*} \cdot \sqrt{(b_2 \cdot b_2 + \left(-a \cdot c\right))_*} - b_2 \cdot b_2}{\sqrt{(b_2 \cdot b_2 + \left(-a \cdot c\right))_*} + b_2}\right)}}}{a}\]
    9. Applied log-div43.3

      \[\leadsto \frac{e^{\color{blue}{\log \left(\sqrt{(b_2 \cdot b_2 + \left(-a \cdot c\right))_*} \cdot \sqrt{(b_2 \cdot b_2 + \left(-a \cdot c\right))_*} - b_2 \cdot b_2\right) - \log \left(\sqrt{(b_2 \cdot b_2 + \left(-a \cdot c\right))_*} + b_2\right)}}}{a}\]
    10. Applied exp-diff43.3

      \[\leadsto \frac{\color{blue}{\frac{e^{\log \left(\sqrt{(b_2 \cdot b_2 + \left(-a \cdot c\right))_*} \cdot \sqrt{(b_2 \cdot b_2 + \left(-a \cdot c\right))_*} - b_2 \cdot b_2\right)}}{e^{\log \left(\sqrt{(b_2 \cdot b_2 + \left(-a \cdot c\right))_*} + b_2\right)}}}}{a}\]
    11. Simplified19.5

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

    if 5.2948860561332035e+135 < b_2

    1. Initial program 61.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.5692996466264766 \cdot 10^{+148}:\\ \;\;\;\;\frac{-2 \cdot b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.83030392761771 \cdot 10^{-133}:\\ \;\;\;\;\frac{\sqrt{(b_2 \cdot b_2 + \left(a \cdot \left(-c\right)\right))_*} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 5.2948860561332035 \cdot 10^{+135}:\\ \;\;\;\;\frac{\frac{a \cdot \left(-c\right)}{e^{\log \left(\sqrt{(b_2 \cdot b_2 + \left(a \cdot \left(-c\right)\right))_*} + b_2\right)}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot \frac{c \cdot a}{b_2}}{a}\\ \end{array}\]

Runtime

Time bar (total: 27.5s)Debug logProfile

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