Average Error: 34.5 → 10.4
Time: 28.9s
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 -9.597286582436852 \cdot 10^{+133}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b} - \frac{b}{a} \cdot \frac{2}{3}\\ \mathbf{elif}\;b \le 2.2203512736017704 \cdot 10^{-42}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b + c \cdot \left(-3 \cdot a\right)} - b}{a}}{3}\\ \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 < -9.597286582436852e+133

    1. Initial program 53.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*53.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 2.9

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

    if -9.597286582436852e+133 < b < 2.2203512736017704e-42

    1. Initial program 14.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*14.7

      \[\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 div-inv14.7

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

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

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

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

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

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

    if 2.2203512736017704e-42 < b

    1. Initial program 54.1

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

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

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

Runtime

Time bar (total: 28.9s)Debug logProfile

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