Average Error: 29.0 → 16.8
Time: 18.2s
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 847.8040454665298:\\ \;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\ \mathbf{elif}\;b \le 2027.6007436845587:\\ \;\;\;\;\frac{\frac{\frac{-3}{2}}{\frac{b}{c \cdot a}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 11115.263941880365:\\ \;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Split input into 3 regimes
  2. if b < 847.8040454665298 or 2027.6007436845587 < b < 11115.263941880365

    1. Initial program 19.1

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied flip3--19.2

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

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

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

    if 847.8040454665298 < b < 2027.6007436845587

    1. Initial program 27.1

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

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

      \[\leadsto \frac{\color{blue}{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied clear-num23.4

      \[\leadsto \frac{\frac{-3}{2} \cdot \color{blue}{\frac{1}{\frac{b}{a \cdot c}}}}{3 \cdot a}\]
    6. Using strategy rm
    7. Applied un-div-inv23.4

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

    if 11115.263941880365 < b

    1. Initial program 38.5

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

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification16.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 847.8040454665298:\\ \;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\ \mathbf{elif}\;b \le 2027.6007436845587:\\ \;\;\;\;\frac{\frac{\frac{-3}{2}}{\frac{b}{c \cdot a}}}{3 \cdot a}\\ \mathbf{elif}\;b \le 11115.263941880365:\\ \;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019050 
(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)))