Average Error: 33.5 → 12.5
Time: 3.2m
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 -6.314971629418898 \cdot 10^{+144}:\\ \;\;\;\;\frac{-1}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 1.420649742292286 \cdot 10^{-308}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{if}\;b \le 9.317578771174697 \cdot 10^{+82}:\\ \;\;\;\;\frac{-c}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b \cdot 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 4 regimes
  2. if b < -6.314971629418898e+144

    1. Initial program 57.9

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

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

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

    if -6.314971629418898e+144 < b < 1.420649742292286e-308

    1. Initial program 8.7

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

      \[\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 associate-/r*8.7

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

    if 1.420649742292286e-308 < b < 9.317578771174697e+82

    1. Initial program 31.8

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

      \[\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--31.9

      \[\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 simplify17.4

      \[\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-out17.4

      \[\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-neg17.4

      \[\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-neg17.4

      \[\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 simplify9.3

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

    if 9.317578771174697e+82 < b

    1. Initial program 57.8

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

      \[\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--57.8

      \[\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 simplify30.5

      \[\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-out30.5

      \[\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-neg30.5

      \[\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-neg30.5

      \[\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 simplify27.4

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

      \[\leadsto -\frac{1 \cdot c}{\color{blue}{2 \cdot b}}\]
    12. Applied simplify3.3

      \[\leadsto \color{blue}{\frac{-c}{2 \cdot b}}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify12.5

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -6.314971629418898 \cdot 10^{+144}:\\ \;\;\;\;\frac{-1}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 1.420649742292286 \cdot 10^{-308}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{if}\;b \le 9.317578771174697 \cdot 10^{+82}:\\ \;\;\;\;\frac{-c}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b \cdot 2}\\ \end{array}}\]

Runtime

Time bar (total: 3.2m)Debug logProfile

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