Average Error: 32.8 → 18.9
Time: 38.8s
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 -8.11375828407908 \cdot 10^{-162}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b + \sqrt{(\left(-3\right) \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*}}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Split input into 2 regimes
  2. if b < -8.11375828407908e-162

    1. Initial program 22.6

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

    if -8.11375828407908e-162 < b

    1. Initial program 38.6

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

      \[\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--38.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 simplify21.2

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

      \[\leadsto \frac{\frac{\left(c \cdot a\right) \cdot \left(-3\right)}{\sqrt{\color{blue}{{b}^{2} - 3 \cdot \left(c \cdot a\right)}} + b}}{3 \cdot a}\]
    7. Applied simplify16.8

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

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

      \[\leadsto \color{blue}{\frac{-c}{b + \sqrt{(\left(-3\right) \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*}}}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 38.8s)Debug logProfile

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