Average Error: 33.4 → 8.9
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 -3.03904331168325 \cdot 10^{+149}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 5.459258275809116 \cdot 10^{-128}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}{3 \cdot a}\\ \mathbf{if}\;b \le 4.206205892232988 \cdot 10^{+83}:\\ \;\;\;\;\frac{\frac{\frac{\left(a \cdot c\right) \cdot \left(-3\right)}{\sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} + b}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\left(-b\right) - b\right) + \left(\frac{3}{2} \cdot c\right) \cdot \frac{a}{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 < -3.03904331168325e+149

    1. Initial program 59.0

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

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

    if -3.03904331168325e+149 < b < 5.459258275809116e-128

    1. Initial program 11.0

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

    if 5.459258275809116e-128 < b < 4.206205892232988e+83

    1. Initial program 39.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*39.4

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

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

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

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

    if 4.206205892232988e+83 < b

    1. Initial program 58.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-+58.1

      \[\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 simplify30.6

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

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -3.03904331168325 \cdot 10^{+149}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 5.459258275809116 \cdot 10^{-128}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}{3 \cdot a}\\ \mathbf{if}\;b \le 4.206205892232988 \cdot 10^{+83}:\\ \;\;\;\;\frac{\frac{\frac{\left(a \cdot c\right) \cdot \left(-3\right)}{\sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} + b}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\left(-b\right) - b\right) + \left(\frac{3}{2} \cdot c\right) \cdot \frac{a}{b}}\\ \end{array}}\]

Runtime

Time bar (total: 2.2m)Debug logProfile

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