Average Error: 32.7 → 8.5
Time: 19.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 -7.742439590843584 \cdot 10^{+150}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b_2 \le -3.6232145061252395 \cdot 10^{-277}:\\ \;\;\;\;\frac{\sqrt{(b_2 \cdot b_2 + \left(-c \cdot a\right))_*} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.8008099183440377 \cdot 10^{+94}:\\ \;\;\;\;\frac{\frac{(c \cdot \left(-a\right) + 0)_*}{a}}{\sqrt{(b_2 \cdot b_2 + \left(-c \cdot a\right))_*} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{b_2}{c} \cdot -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 < -7.742439590843584e+150

    1. Initial program 59.9

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

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

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

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

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

    if -7.742439590843584e+150 < b_2 < -3.6232145061252395e-277

    1. Initial program 7.3

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

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

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

    if -3.6232145061252395e-277 < b_2 < 1.8008099183440377e+94

    1. Initial program 30.9

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

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

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

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

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

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

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

    if 1.8008099183440377e+94 < b_2

    1. Initial program 58.2

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity58.2

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}{a}\]
    5. Applied associate-/l*58.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -7.742439590843584 \cdot 10^{+150}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b_2 \le -3.6232145061252395 \cdot 10^{-277}:\\ \;\;\;\;\frac{\sqrt{(b_2 \cdot b_2 + \left(-c \cdot a\right))_*} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.8008099183440377 \cdot 10^{+94}:\\ \;\;\;\;\frac{\frac{(c \cdot \left(-a\right) + 0)_*}{a}}{\sqrt{(b_2 \cdot b_2 + \left(-c \cdot a\right))_*} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{b_2}{c} \cdot -2}\\ \end{array}\]

Runtime

Time bar (total: 19.5s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes32.78.55.527.289.1%
herbie shell --seed 2018296 +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))