Average Error: 33.1 → 14.2
Time: 18.4s
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.3274816917726008 \cdot 10^{+154}:\\ \;\;\;\;\frac{\left(\frac{3}{2} \cdot \frac{a \cdot c}{b} - b\right) - b}{3 \cdot a}\\ \mathbf{elif}\;b \le 2.18731862420923 \cdot 10^{-49}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}{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 3 regimes
  2. if b < -1.3274816917726008e+154

    1. Initial program 60.9

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

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

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

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

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

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

    if -1.3274816917726008e+154 < b < 2.18731862420923e-49

    1. Initial program 12.3

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

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

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

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

    if 2.18731862420923e-49 < b

    1. Initial program 53.6

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.3274816917726008 \cdot 10^{+154}:\\ \;\;\;\;\frac{\left(\frac{3}{2} \cdot \frac{a \cdot c}{b} - b\right) - b}{3 \cdot a}\\ \mathbf{elif}\;b \le 2.18731862420923 \cdot 10^{-49}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}{3 \cdot a}\\ \end{array}\]

Reproduce

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