Average Error: 33.5 → 6.8
Time: 3.3m
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}\;\frac{-2}{3} \cdot b \le -1.784004531109883 \cdot 10^{+87}:\\ \;\;\;\;\frac{c}{\left(\frac{3}{2} \cdot c\right) \cdot \frac{a}{b} - b \cdot 2}\\ \mathbf{if}\;\frac{-2}{3} \cdot b \le -6.602787576981295 \cdot 10^{-299}:\\ \;\;\;\;\frac{c}{3} \cdot \frac{3}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}\\ \mathbf{if}\;\frac{-2}{3} \cdot b \le 4.234302703938596 \cdot 10^{+144}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 3}{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-2}{3} \cdot b}{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) < -1.784004531109883e+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. Using strategy rm
    3. Applied flip-+58.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 simplify31.0

      \[\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-identity31.0

      \[\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-frac32.2

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

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

      \[\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 simplify28.2

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

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

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

    if -1.784004531109883e+87 < (* -2/3 b) < -6.602787576981295e-299

    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.5

      \[\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 -6.602787576981295e-299 < (* -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.

Runtime

Time bar (total: 3.3m)Debug logProfile

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