Average Error: 33.0 → 14.9
Time: 2.0m
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 -2.4906142395594343 \cdot 10^{+153}:\\ \;\;\;\;\frac{(\left(\frac{c}{b}\right) \cdot \left(\frac{3}{2} \cdot a\right) + \left(b + b\right))_*}{\frac{a \cdot 3}{-1}}\\ \mathbf{if}\;b \le 4.377561557327541 \cdot 10^{-224}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c \cdot \left(a \cdot 3\right)}{a \cdot 3}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \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 < -2.4906142395594343e+153

    1. Initial program 60.6

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

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

      \[\leadsto \left(\left(-b\right) + \color{blue}{\left(-\left(b + \frac{3}{2} \cdot \frac{c \cdot a}{b}\right)\right)}\right) \cdot \frac{1}{3 \cdot a}\]
    5. Applied simplify2.7

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

    if -2.4906142395594343e+153 < b < 4.377561557327541e-224

    1. Initial program 9.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 associate-/r*9.5

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

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

    if 4.377561557327541e-224 < b

    1. Initial program 45.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 div-inv46.0

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

      \[\leadsto \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}}} \cdot \frac{1}{3 \cdot a}\]
    6. Applied associate-*l/46.0

      \[\leadsto \color{blue}{\frac{\left(\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}\right) \cdot \frac{1}{3 \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}\]
    7. Applied simplify22.3

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

Runtime

Time bar (total: 2.0m)Debug logProfile

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