Average Error: 33.7 → 11.9
Time: 37.4s
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.2673540435462902 \cdot 10^{+135}:\\ \;\;\;\;\frac{\frac{-2}{3} \cdot b}{a}\\ \mathbf{elif}\;b \le 5.909795554530142 \cdot 10^{-214}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 3}{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}\\ \mathbf{elif}\;b \le 1.5129699399121617 \cdot 10^{+151}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\left(-b\right) - \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 3}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{-3}{2} \cdot \frac{c \cdot a}{b}}{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 b < -2.2673540435462902e+135

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

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

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

    if -2.2673540435462902e+135 < b < 5.909795554530142e-214

    1. Initial program 10.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 clear-num10.5

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

    if 5.909795554530142e-214 < b < 1.5129699399121617e+151

    1. Initial program 37.6

      \[\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*37.6

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

      \[\leadsto \frac{\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}}{a}\]
    6. Applied associate-/l/37.7

      \[\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}}{3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}{a}\]
    7. Simplified16.0

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

      \[\leadsto \frac{\frac{3 \cdot \left(c \cdot a\right)}{3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}\right)}}{a}\]
    9. Using strategy rm
    10. Applied times-frac15.9

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

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

    if 1.5129699399121617e+151 < b

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.2673540435462902 \cdot 10^{+135}:\\ \;\;\;\;\frac{\frac{-2}{3} \cdot b}{a}\\ \mathbf{elif}\;b \le 5.909795554530142 \cdot 10^{-214}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 3}{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}\\ \mathbf{elif}\;b \le 1.5129699399121617 \cdot 10^{+151}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\left(-b\right) - \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 3}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{-3}{2} \cdot \frac{c \cdot a}{b}}{3}}{a}\\ \end{array}\]

Runtime

Time bar (total: 37.4s)Debug logProfile

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