Average Error: 33.3 → 10.3
Time: 2.1m
Precision: 64
Internal Precision: 3456
\[\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.238643463732416 \cdot 10^{+127}:\\ \;\;\;\;\frac{\frac{c}{b}}{\frac{3}{\frac{3}{2}}} - \frac{b + b}{a \cdot 3}\\ \mathbf{if}\;b \le 6.013511059956263 \cdot 10^{-15}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{(\left(a \cdot \frac{c}{b}\right) \cdot \frac{3}{2} + \left(\left(-b\right) - 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 3 regimes
  2. if b < -6.238643463732416e+127

    1. Initial program 51.3

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

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

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

    if -6.238643463732416e+127 < b < 6.013511059956263e-15

    1. Initial program 14.4

      \[\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*14.5

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

    if 6.013511059956263e-15 < b

    1. Initial program 54.5

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

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

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

      \[\leadsto \frac{\frac{c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \color{blue}{\left(b - \frac{3}{2} \cdot \frac{c \cdot a}{b}\right)}}}{3 \cdot a}\]
    6. Applied simplify6.6

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -6.238643463732416 \cdot 10^{+127}:\\ \;\;\;\;\frac{\frac{c}{b}}{\frac{3}{\frac{3}{2}}} - \frac{b + b}{a \cdot 3}\\ \mathbf{if}\;b \le 6.013511059956263 \cdot 10^{-15}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{(\left(a \cdot \frac{c}{b}\right) \cdot \frac{3}{2} + \left(\left(-b\right) - b\right))_*}\\ \end{array}}\]

Runtime

Time bar (total: 2.1m)Debug logProfile

herbie shell --seed '#(1064173506 2580572819 2847706409 4129882574 1125180799 1845288547)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))