Average Error: 33.3 → 22.2
Time: 1.2m
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 -3.2921006530756106 \cdot 10^{-227}:\\ \;\;\;\;\frac{(\left(\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\right) \cdot \left(\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\right) + \left(-b\right))_*}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot \left(-c\right)}{a \cdot 3}}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + 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 2 regimes
  2. if b < -3.2921006530756106e-227

    1. Initial program 22.5

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify22.5

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

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

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

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

    if -3.2921006530756106e-227 < b

    1. Initial program 40.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify40.7

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{\left(a \cdot 3\right) \cdot \left(-c\right)}{a \cdot 3}}}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 1.2m)Debug logProfile

herbie shell --seed '#(1071821486 549052472 3784827256 1559736200 3548510075 881134285)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))