Average Error: 33.4 → 8.7
Time: 2.3m
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 -4.629761057018838 \cdot 10^{+149}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 1.163420619199811 \cdot 10^{-123}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(-3\right) \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{if}\;b \le 1.8587181320047136 \cdot 10^{+87}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot \left(-c\right)}{a \cdot 3}}{\sqrt{(\left(-3\right) \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c}{b}}{-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 < -4.629761057018838e+149

    1. Initial program 59.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Taylor expanded around -inf 2.4

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

    if -4.629761057018838e+149 < b < 1.163420619199811e-123

    1. Initial program 11.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied associate-/r*11.1

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

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

    if 1.163420619199811e-123 < b < 1.8587181320047136e+87

    1. Initial program 39.9

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied clear-num39.9

      \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}\]
    4. Applied simplify39.9

      \[\leadsto \frac{1}{\color{blue}{\frac{3 \cdot a}{\sqrt{(\left(-3\right) \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} - b}}}\]
    5. Using strategy rm
    6. Applied flip--40.0

      \[\leadsto \frac{1}{\frac{3 \cdot a}{\color{blue}{\frac{\sqrt{(\left(-3\right) \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(\left(-3\right) \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} - b \cdot b}{\sqrt{(\left(-3\right) \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} + b}}}}\]
    7. Applied associate-/r/40.0

      \[\leadsto \frac{1}{\color{blue}{\frac{3 \cdot a}{\sqrt{(\left(-3\right) \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} \cdot \sqrt{(\left(-3\right) \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} - b \cdot b} \cdot \left(\sqrt{(\left(-3\right) \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} + b\right)}}\]
    8. Applied associate-/r*40.0

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

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

    if 1.8587181320047136e+87 < b

    1. Initial program 58.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied clear-num58.1

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

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

      \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c}}}\]
    6. Applied simplify2.6

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

Runtime

Time bar (total: 2.3m)Debug logProfile

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