Average Error: 28.3 → 9.1
Time: 6.9m
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 9.884043115617015:\\ \;\;\;\;\frac{(\left(\sqrt{(b \cdot b + \left(a \cdot \left(-3 \cdot c\right)\right))_*}\right) \cdot \left((b \cdot b + \left(a \cdot \left(-3 \cdot c\right)\right))_*\right) + \left(-b \cdot \left(b \cdot b\right)\right))_*}{\left(\left(b \cdot \sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*} + b \cdot b\right) + \sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*}\right) \cdot \left(3 \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{(\left(\left(a \cdot c\right) \cdot \frac{-9}{2}\right) \cdot b + \left(\frac{\frac{27}{8}}{b} \cdot \left(\left(a \cdot c\right) \cdot \left(a \cdot c\right)\right)\right))_*}{a \cdot \left(b \cdot b + (\left(\sqrt{(\left(a \cdot c\right) \cdot -3 + \left(b \cdot b\right))_*}\right) \cdot b + \left((\left(a \cdot c\right) \cdot -3 + \left(b \cdot b\right))_*\right))_*\right)} \cdot \frac{1}{3}\\ \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 < 9.884043115617015

    1. Initial program 13.0

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

      \[\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 flip3--13.1

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

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

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

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

    if 9.884043115617015 < b

    1. Initial program 32.9

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Simplified32.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 flip3--33.0

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

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

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

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

      \[\leadsto \frac{\color{blue}{(\frac{-9}{2} \cdot \left(\left(a \cdot c\right) \cdot b\right) + \left(\frac{27}{8} \cdot \frac{\left(a \cdot c\right) \cdot \left(a \cdot c\right)}{b}\right))_*}}{\left(3 \cdot a\right) \cdot \left(\sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} + \left(b \cdot b + \sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} \cdot b\right)\right)}\]
    9. Using strategy rm
    10. Applied *-un-lft-identity8.1

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

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

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

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

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

      \[\leadsto \color{blue}{1} \cdot \frac{(\frac{-9}{2} \cdot \left(\left(a \cdot c\right) \cdot b\right) + \left(\frac{27}{8} \cdot \frac{\left(a \cdot c\right) \cdot \left(a \cdot c\right)}{b}\right))_*}{\left(3 \cdot a\right) \cdot \left(\sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} + \left(b \cdot b + \sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} \cdot b\right)\right)}\]
    16. Simplified8.0

      \[\leadsto 1 \cdot \color{blue}{\frac{(\left(\frac{-9}{2} \cdot \left(c \cdot a\right)\right) \cdot b + \left(\frac{\frac{27}{8}}{b} \cdot \left(\left(c \cdot a\right) \cdot \left(c \cdot a\right)\right)\right))_*}{\left(3 \cdot a\right) \cdot \left(b \cdot b + (\left(\sqrt{(\left(c \cdot a\right) \cdot -3 + \left(b \cdot b\right))_*}\right) \cdot b + \left((\left(c \cdot a\right) \cdot -3 + \left(b \cdot b\right))_*\right))_*\right)}}\]
    17. Using strategy rm
    18. Applied associate-*l*8.0

      \[\leadsto 1 \cdot \frac{(\left(\frac{-9}{2} \cdot \left(c \cdot a\right)\right) \cdot b + \left(\frac{\frac{27}{8}}{b} \cdot \left(\left(c \cdot a\right) \cdot \left(c \cdot a\right)\right)\right))_*}{\color{blue}{3 \cdot \left(a \cdot \left(b \cdot b + (\left(\sqrt{(\left(c \cdot a\right) \cdot -3 + \left(b \cdot b\right))_*}\right) \cdot b + \left((\left(c \cdot a\right) \cdot -3 + \left(b \cdot b\right))_*\right))_*\right)\right)}}\]
    19. Applied *-un-lft-identity8.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 9.884043115617015:\\ \;\;\;\;\frac{(\left(\sqrt{(b \cdot b + \left(a \cdot \left(-3 \cdot c\right)\right))_*}\right) \cdot \left((b \cdot b + \left(a \cdot \left(-3 \cdot c\right)\right))_*\right) + \left(-b \cdot \left(b \cdot b\right)\right))_*}{\left(\left(b \cdot \sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*} + b \cdot b\right) + \sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*}\right) \cdot \left(3 \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{(\left(\left(a \cdot c\right) \cdot \frac{-9}{2}\right) \cdot b + \left(\frac{\frac{27}{8}}{b} \cdot \left(\left(a \cdot c\right) \cdot \left(a \cdot c\right)\right)\right))_*}{a \cdot \left(b \cdot b + (\left(\sqrt{(\left(a \cdot c\right) \cdot -3 + \left(b \cdot b\right))_*}\right) \cdot b + \left((\left(a \cdot c\right) \cdot -3 + \left(b \cdot b\right))_*\right))_*\right)} \cdot \frac{1}{3}\\ \end{array}\]

Reproduce

herbie shell --seed 2019072 +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical, narrow range"
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))