Average Error: 33.7 → 9.0
Time: 1.3m
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 -1.2146682064611755 \cdot 10^{+151}:\\ \;\;\;\;\frac{-c}{\frac{c \cdot a}{b} \cdot \frac{3}{2}}\\ \mathbf{elif}\;b \le 3.365999750545595 \cdot 10^{-128}:\\ \;\;\;\;\frac{1}{a \cdot 3} \cdot \left(\sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)\\ \mathbf{elif}\;b \le 2.965230666934693 \cdot 10^{+126}:\\ \;\;\;\;\frac{-c}{b + \sqrt{{b}^{2} - \left(\sqrt[3]{3 \cdot \left(c \cdot a\right)} \cdot \sqrt[3]{3 \cdot \left(c \cdot a\right)}\right) \cdot \sqrt[3]{3 \cdot \left(c \cdot a\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b + 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 < -1.2146682064611755e+151

    1. Initial program 59.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Initial simplification59.6

      \[\leadsto \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 flip--62.2

      \[\leadsto \frac{\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}}}{3 \cdot a}\]
    5. Applied associate-/l/62.2

      \[\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}{\left(3 \cdot a\right) \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b\right)}}\]
    6. Simplified62.5

      \[\leadsto \frac{\color{blue}{\left(-c\right) \cdot \left(3 \cdot a\right)}}{\left(3 \cdot a\right) \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b\right)}\]
    7. Using strategy rm
    8. Applied distribute-lft-neg-out62.5

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

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

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

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

    if -1.2146682064611755e+151 < b < 3.365999750545595e-128

    1. Initial program 11.0

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Initial simplification11.0

      \[\leadsto \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-inv11.0

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

    if 3.365999750545595e-128 < b < 2.965230666934693e+126

    1. Initial program 41.0

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Initial simplification41.0

      \[\leadsto \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 flip--41.1

      \[\leadsto \frac{\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}}}{3 \cdot a}\]
    5. Applied associate-/l/43.3

      \[\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}{\left(3 \cdot a\right) \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b\right)}}\]
    6. Simplified17.0

      \[\leadsto \frac{\color{blue}{\left(-c\right) \cdot \left(3 \cdot a\right)}}{\left(3 \cdot a\right) \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b\right)}\]
    7. Using strategy rm
    8. Applied distribute-lft-neg-out17.0

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

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

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

      \[\leadsto -\frac{c}{b + \sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(a \cdot c\right)}}}\]
    12. Using strategy rm
    13. Applied add-cube-cbrt5.6

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

    if 2.965230666934693e+126 < b

    1. Initial program 60.6

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Initial simplification60.6

      \[\leadsto \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 flip--60.6

      \[\leadsto \frac{\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}}}{3 \cdot a}\]
    5. Applied associate-/l/60.7

      \[\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}{\left(3 \cdot a\right) \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b\right)}}\]
    6. Simplified35.1

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

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

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

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

      \[\leadsto -\frac{c}{b + \color{blue}{b}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification9.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.2146682064611755 \cdot 10^{+151}:\\ \;\;\;\;\frac{-c}{\frac{c \cdot a}{b} \cdot \frac{3}{2}}\\ \mathbf{elif}\;b \le 3.365999750545595 \cdot 10^{-128}:\\ \;\;\;\;\frac{1}{a \cdot 3} \cdot \left(\sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b\right)\\ \mathbf{elif}\;b \le 2.965230666934693 \cdot 10^{+126}:\\ \;\;\;\;\frac{-c}{b + \sqrt{{b}^{2} - \left(\sqrt[3]{3 \cdot \left(c \cdot a\right)} \cdot \sqrt[3]{3 \cdot \left(c \cdot a\right)}\right) \cdot \sqrt[3]{3 \cdot \left(c \cdot a\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b + b}\\ \end{array}\]

Runtime

Time bar (total: 1.3m)Debug logProfile

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