Average Error: 33.1 → 8.1
Time: 45.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.9457088428946486 \cdot 10^{+104}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -1.878048842534505 \cdot 10^{-285}:\\ \;\;\;\;\frac{\sqrt{\sqrt{\left(a \cdot -3\right) \cdot c + b \cdot b} - b}}{\frac{a \cdot 3}{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}}}\\ \mathbf{elif}\;b \le 1.8753264509348336 \cdot 10^{+81}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{3}{2} \cdot \frac{a \cdot c}{b} - b \cdot 2}\\ \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.9457088428946486e+104

    1. Initial program 46.2

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

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

    if -2.9457088428946486e+104 < b < -1.878048842534505e-285

    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 add-sqr-sqrt9.0

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

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

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

    if -1.878048842534505e-285 < b < 1.8753264509348336e+81

    1. Initial program 30.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-+30.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 associate-/l/34.7

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{1}{a}\right)}^{1}} \cdot {\left(\frac{c \cdot a}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\right)}^{1}\]
    12. Applied pow-prod-down17.1

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

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

    if 1.8753264509348336e+81 < b

    1. Initial program 57.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-+57.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 associate-/l/57.4

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

      \[\leadsto \frac{\color{blue}{3 \cdot \left(c \cdot a\right)}}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\]
    6. Using strategy rm
    7. Applied times-frac29.8

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{1}{a}\right)}^{1}} \cdot {\left(\frac{c \cdot a}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\right)}^{1}\]
    12. Applied pow-prod-down29.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.9457088428946486 \cdot 10^{+104}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -1.878048842534505 \cdot 10^{-285}:\\ \;\;\;\;\frac{\sqrt{\sqrt{\left(a \cdot -3\right) \cdot c + b \cdot b} - b}}{\frac{a \cdot 3}{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}}}\\ \mathbf{elif}\;b \le 1.8753264509348336 \cdot 10^{+81}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{3}{2} \cdot \frac{a \cdot c}{b} - b \cdot 2}\\ \end{array}\]

Runtime

Time bar (total: 45.4s)Debug logProfile

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