Average Error: 33.2 → 9.0
Time: 2.7m
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.9506286404998383 \cdot 10^{+99}:\\ \;\;\;\;\frac{\frac{\frac{3}{2} \cdot a}{\frac{b}{c}} - \left(b + b\right)}{3 \cdot a}\\ \mathbf{if}\;b \le 7.461795707230234 \cdot 10^{-267}:\\ \;\;\;\;\left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right) \cdot \frac{1}{3 \cdot a}\\ \mathbf{if}\;b \le 4.080064831394084 \cdot 10^{-11}:\\ \;\;\;\;\frac{\frac{c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{c}{b} \cdot \left(\frac{3}{2} \cdot a\right) - 2 \cdot b}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if b < -2.9506286404998383e+99

    1. Initial program 45.0

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

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

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

    if -2.9506286404998383e+99 < b < 7.461795707230234e-267

    1. Initial program 9.8

      \[\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-inv9.9

      \[\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}}\]

    if 7.461795707230234e-267 < b < 4.080064831394084e-11

    1. Initial program 26.0

      \[\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-+26.2

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

      \[\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}\]

    if 4.080064831394084e-11 < b

    1. Initial program 54.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 flip-+54.8

      \[\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 simplify25.9

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

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

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

Runtime

Time bar (total: 2.7m)Debug logProfile

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