Average Error: 33.3 → 13.2
Time: 2.7m
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 -3.2668211640455487 \cdot 10^{-270}:\\ \;\;\;\;\frac{(\left(\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\right) \cdot \left(\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\right) + \left(-b\right))_*}{3 \cdot a}\\ \mathbf{if}\;b \le 1.490043818161701 \cdot 10^{+149}:\\ \;\;\;\;\frac{-c}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}\\ \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 3 regimes
  2. if b < -3.2668211640455487e-270

    1. Initial program 22.0

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

      \[\leadsto \color{blue}{\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 add-sqr-sqrt21.9

      \[\leadsto \frac{\sqrt{\color{blue}{\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}{3 \cdot a}\]
    5. Applied sqrt-prod22.1

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

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

    if -3.2668211640455487e-270 < b < 1.490043818161701e+149

    1. Initial program 33.0

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

      \[\leadsto \color{blue}{\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--33.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 simplify15.7

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

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

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

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

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

    if 1.490043818161701e+149 < b

    1. Initial program 62.3

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

      \[\leadsto \color{blue}{\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.4

      \[\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 simplify36.8

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

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

      \[\leadsto \color{blue}{\frac{c}{b + b} \cdot \left(-1\right)}\]
  3. Recombined 3 regimes into one program.
  4. Applied simplify13.2

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -3.2668211640455487 \cdot 10^{-270}:\\ \;\;\;\;\frac{(\left(\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\right) \cdot \left(\sqrt{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\right) + \left(-b\right))_*}{3 \cdot a}\\ \mathbf{if}\;b \le 1.490043818161701 \cdot 10^{+149}:\\ \;\;\;\;\frac{-c}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b + b}\\ \end{array}}\]

Runtime

Time bar (total: 2.7m)Debug logProfile

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