Average Error: 33.5 → 8.8
Time: 20.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 -2.1697353091846564 \cdot 10^{+75}:\\ \;\;\;\;(\frac{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 6.119427815713366 \cdot 10^{-166}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{(a \cdot \left(-3 \cdot c\right) + \left(b \cdot b\right))_*} - b}{a}\\ \mathbf{elif}\;b \le 2.3181001659774606 \cdot 10^{-05}:\\ \;\;\;\;\frac{\frac{\frac{\left(c \cdot a\right) \cdot 3}{3}}{\left(-b\right) - \sqrt{(\left(-3 \cdot a\right) \cdot c + \left(b \cdot b\right))_*}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Split input into 4 regimes
  2. if b < -2.1697353091846564e+75

    1. Initial program 40.3

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b} - \frac{2}{3} \cdot \frac{b}{a}}\]
    3. Simplified4.9

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

    if -2.1697353091846564e+75 < b < 6.119427815713366e-166

    1. Initial program 10.8

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

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

      \[\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.8

      \[\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}\]
    6. Applied times-frac11.0

      \[\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}}\]
    7. Simplified11.0

      \[\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}\]
    8. Simplified10.9

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

    if 6.119427815713366e-166 < b < 2.3181001659774606e-05

    1. Initial program 31.9

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a}\]
    3. Simplified31.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. Using strategy rm
    5. Applied associate-/r*31.9

      \[\leadsto \color{blue}{\frac{\frac{\left(-b\right) + \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}{3}}{a}}\]
    6. Using strategy rm
    7. Applied flip-+32.0

      \[\leadsto \frac{\frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*} \cdot \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}{\left(-b\right) - \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}}}{3}}{a}\]
    8. Applied associate-/l/32.1

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

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

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

    if 2.3181001659774606e-05 < b

    1. Initial program 55.2

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}{3 \cdot a}\]
    3. Simplified55.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. Taylor expanded around inf 5.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.1697353091846564 \cdot 10^{+75}:\\ \;\;\;\;(\frac{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 6.119427815713366 \cdot 10^{-166}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{(a \cdot \left(-3 \cdot c\right) + \left(b \cdot b\right))_*} - b}{a}\\ \mathbf{elif}\;b \le 2.3181001659774606 \cdot 10^{-05}:\\ \;\;\;\;\frac{\frac{\frac{\left(c \cdot a\right) \cdot 3}{3}}{\left(-b\right) - \sqrt{(\left(-3 \cdot a\right) \cdot c + \left(b \cdot b\right))_*}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Runtime

Time bar (total: 20.8s)Debug logProfile

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