Average Error: 33.6 → 11.2
Time: 1.8m
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 -1.6424038809365114 \cdot 10^{-07}:\\ \;\;\;\;\frac{\frac{\frac{3}{2}}{b}}{\frac{3}{c}} - \frac{b + b}{3 \cdot a}\\ \mathbf{if}\;b \le 1.6532775834371295 \cdot 10^{-59}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*} - b}{a}\\ \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 < -1.6424038809365114e-07

    1. Initial program 31.2

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

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

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

    if -1.6424038809365114e-07 < b < 1.6532775834371295e-59

    1. Initial program 15.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 *-un-lft-identity15.7

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

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

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

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

    if 1.6532775834371295e-59 < b

    1. Initial program 53.0

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

      \[\leadsto \frac{\color{blue}{\frac{-3}{2} \cdot \frac{c \cdot a}{b}}}{3 \cdot a}\]
    3. Applied simplify8.4

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

Runtime

Time bar (total: 1.8m)Debug logProfile

herbie shell --seed '#(1071373924 2949776965 1885069702 3247780810 90874544 2263903749)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))