Average Error: 33.5 → 6.9
Time: 3.4m
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 \cdot \frac{-2}{3} \le -2.327767601627927 \cdot 10^{+87}:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \mathbf{if}\;b \cdot \frac{-2}{3} \le -1.6038021471621018 \cdot 10^{-298}:\\ \;\;\;\;\frac{3}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}} \cdot \frac{c}{3}\\ \mathbf{if}\;b \cdot \frac{-2}{3} \le 4.234302703938596 \cdot 10^{+144}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 3}{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b \cdot \frac{-2}{3}}{a}\\ \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 (* -2/3 b) < -2.327767601627927e+87

    1. Initial program 58.2

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

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

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

    if -2.327767601627927e+87 < (* -2/3 b) < -1.6038021471621018e-298

    1. Initial program 32.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 flip-+32.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 simplify17.1

      \[\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. Using strategy rm
    6. Applied *-un-lft-identity17.1

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

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

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

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

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

    if -1.6038021471621018e-298 < (* -2/3 b) < 4.234302703938596e+144

    1. Initial program 8.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 clear-num8.8

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

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

    if 4.234302703938596e+144 < (* -2/3 b)

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{-2}{3} \cdot b}}{a}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify6.9

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \cdot \frac{-2}{3} \le -2.327767601627927 \cdot 10^{+87}:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \mathbf{if}\;b \cdot \frac{-2}{3} \le -1.6038021471621018 \cdot 10^{-298}:\\ \;\;\;\;\frac{3}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}} \cdot \frac{c}{3}\\ \mathbf{if}\;b \cdot \frac{-2}{3} \le 4.234302703938596 \cdot 10^{+144}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 3}{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b \cdot \frac{-2}{3}}{a}\\ \end{array}}\]

Runtime

Time bar (total: 3.4m)Debug logProfile

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