Average Error: 33.6 → 12.2
Time: 29.7s
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.578447241049947 \cdot 10^{+97}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le 7.474732290308126 \cdot 10^{-62}:\\ \;\;\;\;\frac{1}{a} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}{3}\\ \mathbf{elif}\;b \le 5.361127884469133 \cdot 10^{+127}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{c \cdot \left(a \cdot -3\right)}{\left(\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*} + b\right) \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}{3 \cdot a}\\ \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 < -9.578447241049947e+97

    1. Initial program 43.0

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied associate-/r*43.0

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

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

      \[\leadsto \color{blue}{\frac{-2}{3} \cdot \frac{b}{a}}\]

    if -9.578447241049947e+97 < b < 7.474732290308126e-62

    1. Initial program 13.3

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied associate-/r*13.3

      \[\leadsto \color{blue}{\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}}\]
    4. Using strategy rm
    5. Applied div-inv13.4

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

    if 7.474732290308126e-62 < b < 5.361127884469133e+127

    1. Initial program 44.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity44.7

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

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

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a}\]
    6. Applied times-frac44.7

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

      \[\leadsto \color{blue}{\frac{1}{3}} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a}\]
    8. Simplified44.7

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

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

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

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

    if 5.361127884469133e+127 < b

    1. Initial program 60.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -9.578447241049947 \cdot 10^{+97}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le 7.474732290308126 \cdot 10^{-62}:\\ \;\;\;\;\frac{1}{a} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}{3}\\ \mathbf{elif}\;b \le 5.361127884469133 \cdot 10^{+127}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{c \cdot \left(a \cdot -3\right)}{\left(\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*} + b\right) \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}{3 \cdot a}\\ \end{array}\]

Runtime

Time bar (total: 29.7s)Debug logProfile

herbie shell --seed 2018248 +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))