Average Error: 33.6 → 11.0
Time: 22.8s
Precision: 64
Internal Precision: 3392
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -9.229839583375616 \cdot 10^{+152}:\\ \;\;\;\;(\frac{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 4.4690311428783294 \cdot 10^{-172}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{(a \cdot \left(-3 \cdot c\right) + \left(b \cdot b\right))_*} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Split input into 3 regimes
  2. if b < -9.229839583375616e+152

    1. Initial program 60.3

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Taylor expanded around inf 60.3

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a}\]
    3. Simplified60.2

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied associate-/r*60.2

      \[\leadsto \color{blue}{\frac{\frac{\left(-b\right) + \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}{3}}{a}}\]
    6. Taylor expanded around -inf 2.8

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b} - \frac{2}{3} \cdot \frac{b}{a}}\]
    7. Simplified2.8

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

    if -9.229839583375616e+152 < b < 4.4690311428783294e-172

    1. Initial program 10.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Taylor expanded around inf 10.1

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a}\]
    3. Simplified10.1

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity10.1

      \[\leadsto \frac{\left(-b\right) + \color{blue}{1 \cdot \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}}{3 \cdot a}\]
    6. Applied *-un-lft-identity10.1

      \[\leadsto \frac{\color{blue}{1 \cdot \left(-b\right)} + 1 \cdot \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}{3 \cdot a}\]
    7. Applied distribute-lft-out10.1

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(-b\right) + \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}\right)}}{3 \cdot a}\]
    8. Applied times-frac10.2

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \frac{\left(-b\right) + \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}{a}}\]
    9. Simplified10.2

      \[\leadsto \color{blue}{\frac{1}{3}} \cdot \frac{\left(-b\right) + \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}{a}\]
    10. Simplified10.3

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

    if 4.4690311428783294e-172 < b

    1. Initial program 48.9

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Taylor expanded around inf 48.9

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a}\]
    3. Simplified48.9

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}}{3 \cdot a}\]
    4. Taylor expanded around inf 13.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -9.229839583375616 \cdot 10^{+152}:\\ \;\;\;\;(\frac{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 4.4690311428783294 \cdot 10^{-172}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{(a \cdot \left(-3 \cdot c\right) + \left(b \cdot b\right))_*} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \end{array}\]

Runtime

Time bar (total: 22.8s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes33.611.05.628.080.7%
herbie shell --seed 2018263 +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))