Average Error: 32.9 → 11.6
Time: 23.4s
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 -5.160909725126374 \cdot 10^{+16}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b_2 \le -2.3699980393789116 \cdot 10^{-62}:\\ \;\;\;\;\frac{\sqrt{b_2^2 + \left(\sqrt{c} \cdot \sqrt{-a}\right)^2}^* - b_2}{a}\\ \mathbf{elif}\;b_2 \le -1.1320615158913861 \cdot 10^{-146}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b_2 \le 7.366603542830882 \cdot 10^{+131}:\\ \;\;\;\;\frac{-c}{\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 < -5.160909725126374e+16 or -2.3699980393789116e-62 < b_2 < -1.1320615158913861e-146

    1. Initial program 26.4

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

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

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

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

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

    if -5.160909725126374e+16 < b_2 < -2.3699980393789116e-62

    1. Initial program 5.1

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

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

      \[\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-sqr-sqrt18.1

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 + \color{blue}{\sqrt{-a \cdot c} \cdot \sqrt{-a \cdot c}}} - b_2}{a}\]
    7. Applied hypot-def18.1

      \[\leadsto \frac{\color{blue}{\sqrt{b_2^2 + \left(\sqrt{-a \cdot c}\right)^2}^*} - b_2}{a}\]
    8. Using strategy rm
    9. Applied distribute-lft-neg-in18.1

      \[\leadsto \frac{\sqrt{b_2^2 + \left(\sqrt{\color{blue}{\left(-a\right) \cdot c}}\right)^2}^* - b_2}{a}\]
    10. Applied sqrt-prod39.8

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

    if -1.1320615158913861e-146 < b_2 < 7.366603542830882e+131

    1. Initial program 28.9

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

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

      \[\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/34.5

      \[\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. Simplified21.4

      \[\leadsto \frac{\color{blue}{-a \cdot c}}{a \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right)}\]
    7. Using strategy rm
    8. Applied distribute-frac-neg21.4

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

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

    if 7.366603542830882e+131 < b_2

    1. Initial program 60.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -5.160909725126374 \cdot 10^{+16}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b_2 \le -2.3699980393789116 \cdot 10^{-62}:\\ \;\;\;\;\frac{\sqrt{b_2^2 + \left(\sqrt{c} \cdot \sqrt{-a}\right)^2}^* - b_2}{a}\\ \mathbf{elif}\;b_2 \le -1.1320615158913861 \cdot 10^{-146}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b_2 \le 7.366603542830882 \cdot 10^{+131}:\\ \;\;\;\;\frac{-c}{\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: 23.4s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes29.211.60.129.160.5%
herbie shell --seed 2018352 +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))