Average Error: 33.1 → 8.5
Time: 19.9s
Precision: 64
Internal Precision: 3136
\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -4.932106039850163 \cdot 10^{+118}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b_2 \le 2.3678203539805926 \cdot 10^{-150}:\\ \;\;\;\;\frac{\sqrt{(b_2 \cdot b_2 + \left(-c \cdot a\right))_*} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 8.664494493943863 \cdot 10^{+88}:\\ \;\;\;\;\frac{\frac{(a \cdot \left(-c\right) + 0)_*}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\ \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 < -4.932106039850163e+118

    1. Initial program 48.6

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

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

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

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

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

    if -4.932106039850163e+118 < b_2 < 2.3678203539805926e-150

    1. Initial program 10.3

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

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

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

    if 2.3678203539805926e-150 < b_2 < 8.664494493943863e+88

    1. Initial program 38.9

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

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

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

      \[\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}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}} \cdot \frac{1}{a}\]
    7. Applied associate-*l/39.0

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

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

    if 8.664494493943863e+88 < b_2

    1. Initial program 58.0

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -4.932106039850163 \cdot 10^{+118}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b_2 \le 2.3678203539805926 \cdot 10^{-150}:\\ \;\;\;\;\frac{\sqrt{(b_2 \cdot b_2 + \left(-c \cdot a\right))_*} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 8.664494493943863 \cdot 10^{+88}:\\ \;\;\;\;\frac{\frac{(a \cdot \left(-c\right) + 0)_*}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Runtime

Time bar (total: 19.9s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes33.18.55.527.689.3%
herbie shell --seed 2018286 +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))