Average Error: 33.6 → 9.0
Time: 1.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 \le -3.1318999115375886 \cdot 10^{+153}:\\ \;\;\;\;\frac{\frac{-2}{3} \cdot b}{a}\\ \mathbf{elif}\;b \le 3.0305825352811166 \cdot 10^{-299}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}{3}}{a}\\ \mathbf{elif}\;b \le 6.727203418714334 \cdot 10^{+51}:\\ \;\;\;\;\frac{1}{\frac{\frac{a}{\left(a \cdot c\right) \cdot 3}}{\frac{1}{\left(\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right) \cdot 3}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{-2 \cdot \frac{b}{c}}\\ \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 < -3.1318999115375886e+153

    1. Initial program 60.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*60.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 2.6

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

    if -3.1318999115375886e+153 < b < 3.0305825352811166e-299

    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 associate-/r*8.7

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

    if 3.0305825352811166e-299 < b < 6.727203418714334e+51

    1. Initial program 30.8

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

      \[\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-+31.0

      \[\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/31.0

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

      \[\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. Using strategy rm
    9. Applied clear-num17.3

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\frac{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)}}}}\]
    10. Using strategy rm
    11. Applied div-inv17.3

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{\left(3 \cdot \left(c \cdot a\right)\right) \cdot \frac{1}{3 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}}\]
    12. Applied associate-/r*17.0

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

    if 6.727203418714334e+51 < b

    1. Initial program 56.3

      \[\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.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 flip-+56.4

      \[\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/56.4

      \[\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. Simplified29.3

      \[\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. Using strategy rm
    9. Applied clear-num29.4

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\frac{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)}}}}\]
    10. Taylor expanded around 0 4.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -3.1318999115375886 \cdot 10^{+153}:\\ \;\;\;\;\frac{\frac{-2}{3} \cdot b}{a}\\ \mathbf{elif}\;b \le 3.0305825352811166 \cdot 10^{-299}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}{3}}{a}\\ \mathbf{elif}\;b \le 6.727203418714334 \cdot 10^{+51}:\\ \;\;\;\;\frac{1}{\frac{\frac{a}{\left(a \cdot c\right) \cdot 3}}{\frac{1}{\left(\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right) \cdot 3}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{-2 \cdot \frac{b}{c}}\\ \end{array}\]

Runtime

Time bar (total: 1.4m)Debug logProfile

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