Average Error: 33.2 → 21.9
Time: 1.5m
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 8.282284427885545 \cdot 10^{-97}:\\ \;\;\;\;(\left(\frac{1}{3 \cdot a}\right) \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}\right) + \left(\frac{-b}{3 \cdot a}\right))_*\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(3 \cdot a\right) \cdot \left(-c\right)}{3 \cdot a}}{b + \sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\\ \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 < 8.282284427885545e-97

    1. Initial program 20.8

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

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

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

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

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

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

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

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

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

    if 8.282284427885545e-97 < b

    1. Initial program 51.4

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

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

      \[\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--51.4

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

      \[\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 simplify23.5

      \[\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.
  4. Applied simplify21.9

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le 8.282284427885545 \cdot 10^{-97}:\\ \;\;\;\;(\left(\frac{1}{3 \cdot a}\right) \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}\right) + \left(\frac{-b}{3 \cdot a}\right))_*\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(3 \cdot a\right) \cdot \left(-c\right)}{3 \cdot a}}{b + \sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\\ \end{array}}\]

Runtime

Time bar (total: 1.5m)Debug logProfile

herbie shell --seed '#(1071246582 2318319007 2683472949 3810440501 3233274817 2724848749)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))