Average Error: 33.6 → 9.2
Time: 28.6s
Precision: 64
Internal Precision: 128
\[\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.3117677308884503 \cdot 10^{+151}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b} - \frac{b}{a} \cdot \frac{2}{3}\\ \mathbf{elif}\;b \le 1.083835695483553 \cdot 10^{-90}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b + c \cdot \left(-3 \cdot a\right)} - b}{a}}{3}\\ \mathbf{elif}\;b \le 9.328895228384538 \cdot 10^{+43}:\\ \;\;\;\;\frac{\left(-3 \cdot c\right) \cdot a}{\left(b + \sqrt{b \cdot b + c \cdot \left(-3 \cdot a\right)}\right) \cdot \left(a \cdot 3\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{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.3117677308884503e+151

    1. Initial program 59.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*59.4

      \[\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 2.5

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

    if -2.3117677308884503e+151 < b < 1.083835695483553e-90

    1. Initial program 11.5

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

      \[\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 associate-/l/11.5

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

      \[\leadsto \frac{\color{blue}{\sqrt{\left(a \cdot -3\right) \cdot c + b \cdot b} - b}}{a \cdot 3}\]
    7. Using strategy rm
    8. Applied associate-/r*11.5

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

    if 1.083835695483553e-90 < b < 9.328895228384538e+43

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

      \[\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 associate-/l/39.2

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

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

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

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

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

    if 9.328895228384538e+43 < b

    1. Initial program 56.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*56.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 4.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.3117677308884503 \cdot 10^{+151}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b} - \frac{b}{a} \cdot \frac{2}{3}\\ \mathbf{elif}\;b \le 1.083835695483553 \cdot 10^{-90}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b + c \cdot \left(-3 \cdot a\right)} - b}{a}}{3}\\ \mathbf{elif}\;b \le 9.328895228384538 \cdot 10^{+43}:\\ \;\;\;\;\frac{\left(-3 \cdot c\right) \cdot a}{\left(b + \sqrt{b \cdot b + c \cdot \left(-3 \cdot a\right)}\right) \cdot \left(a \cdot 3\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \end{array}\]

Runtime

Time bar (total: 28.6s)Debug logProfile

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