Average Error: 33.7 → 13.1
Time: 2.1m
Precision: 64
Internal Precision: 128
\[\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.1267886773287314 \cdot 10^{+97}:\\ \;\;\;\;\frac{(\frac{3}{2} \cdot \left(\frac{a}{\frac{b}{c}}\right) + \left(b \cdot -2\right))_*}{3 \cdot a}\\ \mathbf{elif}\;b \le 3.7120085597217546 \cdot 10^{-57}:\\ \;\;\;\;\frac{\frac{\sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*}}{3}}{a} - \frac{\frac{b}{3}}{a}\\ \mathbf{elif}\;b \le 9.585003209125123 \cdot 10^{+58}:\\ \;\;\;\;\frac{\frac{b \cdot \left(\left(c \cdot 3\right) \cdot a + \left(c \cdot 3\right) \cdot a\right)}{\left(\left(b + \sqrt{(\left(-3 \cdot c\right) \cdot a + \left(b \cdot b\right))_*}\right) \cdot \left(\left(-b\right) - b\right)\right) \cdot 3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot c}{b} \cdot \frac{-3}{2}}{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 < -1.1267886773287314e+97

    1. Initial program 44.2

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

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

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

    if -1.1267886773287314e+97 < b < 3.7120085597217546e-57

    1. Initial program 13.8

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

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

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

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

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

    if 3.7120085597217546e-57 < b < 9.585003209125123e+58

    1. Initial program 44.3

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.585003209125123e+58 < b

    1. Initial program 56.8

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

      \[\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 simplification13.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.1267886773287314 \cdot 10^{+97}:\\ \;\;\;\;\frac{(\frac{3}{2} \cdot \left(\frac{a}{\frac{b}{c}}\right) + \left(b \cdot -2\right))_*}{3 \cdot a}\\ \mathbf{elif}\;b \le 3.7120085597217546 \cdot 10^{-57}:\\ \;\;\;\;\frac{\frac{\sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*}}{3}}{a} - \frac{\frac{b}{3}}{a}\\ \mathbf{elif}\;b \le 9.585003209125123 \cdot 10^{+58}:\\ \;\;\;\;\frac{\frac{b \cdot \left(\left(c \cdot 3\right) \cdot a + \left(c \cdot 3\right) \cdot a\right)}{\left(\left(b + \sqrt{(\left(-3 \cdot c\right) \cdot a + \left(b \cdot b\right))_*}\right) \cdot \left(\left(-b\right) - b\right)\right) \cdot 3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot c}{b} \cdot \frac{-3}{2}}{3 \cdot a}\\ \end{array}\]

Reproduce

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