Average Error: 33.9 → 10.2
Time: 20.4s
Precision: 64
Internal Precision: 3136
\[\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.8050933850793704 \cdot 10^{+94}:\\ \;\;\;\;\left(\frac{c}{b} \cdot \frac{3}{2} - 2 \cdot \frac{b}{a}\right) \cdot \frac{1}{3}\\ \mathbf{elif}\;b \le 2.9745186476250445 \cdot 10^{-41}:\\ \;\;\;\;\frac{1}{a \cdot 3} \cdot \left(\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \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 3 regimes
  2. if b < -2.8050933850793704e+94

    1. Initial program 43.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity43.1

      \[\leadsto \frac{\left(-b\right) + \color{blue}{1 \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    4. Applied *-un-lft-identity43.1

      \[\leadsto \frac{\color{blue}{1 \cdot \left(-b\right)} + 1 \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    5. Applied distribute-lft-out43.1

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

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

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

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

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

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

    if -2.8050933850793704e+94 < b < 2.9745186476250445e-41

    1. Initial program 14.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 div-inv14.4

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

    if 2.9745186476250445e-41 < b

    1. Initial program 54.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*54.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.8050933850793704 \cdot 10^{+94}:\\ \;\;\;\;\left(\frac{c}{b} \cdot \frac{3}{2} - 2 \cdot \frac{b}{a}\right) \cdot \frac{1}{3}\\ \mathbf{elif}\;b \le 2.9745186476250445 \cdot 10^{-41}:\\ \;\;\;\;\frac{1}{a \cdot 3} \cdot \left(\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Runtime

Time bar (total: 20.4s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes33.910.26.028.084.8%
herbie shell --seed 2018285 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))