Average Error: 33.2 → 10.7
Time: 2.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 -9.234735130895007 \cdot 10^{+86}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le 7.359951940587014 \cdot 10^{-86}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 3}{\sqrt{(\left(-3\right) \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c}{-2}}{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 < -9.234735130895007e+86

    1. Initial program 43.3

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

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

    if -9.234735130895007e+86 < b < 7.359951940587014e-86

    1. Initial program 13.2

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

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

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

    if 7.359951940587014e-86 < b

    1. Initial program 51.7

      \[\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-num51.7

      \[\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 simplify51.7

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

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

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

Runtime

Time bar (total: 2.2m)Debug logProfile

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