Average Error: 33.4 → 9.4
Time: 18.2s
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 -1.9917452429919785 \cdot 10^{+149}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b} - \frac{b}{a} \cdot \frac{2}{3}\\ \mathbf{elif}\;b \le 1.4296093021688485 \cdot 10^{-116}:\\ \;\;\;\;\frac{\sqrt{b \cdot b + c \cdot \left(-3 \cdot a\right)} - b}{3 \cdot a}\\ \mathbf{elif}\;b \le 4.7524414552463597 \cdot 10^{+86}:\\ \;\;\;\;\frac{3 \cdot \left(c \cdot a\right)}{\left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right) \cdot \left(3 \cdot a\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 4 regimes
  2. if b < -1.9917452429919785e+149

    1. Initial program 58.9

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

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

    if -1.9917452429919785e+149 < b < 1.4296093021688485e-116

    1. Initial program 11.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*11.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/11.3

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

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

    if 1.4296093021688485e-116 < b < 4.7524414552463597e+86

    1. Initial program 40.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 flip-+40.5

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

      \[\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. Simplified18.6

      \[\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)}\]

    if 4.7524414552463597e+86 < b

    1. Initial program 58.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.9917452429919785 \cdot 10^{+149}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b} - \frac{b}{a} \cdot \frac{2}{3}\\ \mathbf{elif}\;b \le 1.4296093021688485 \cdot 10^{-116}:\\ \;\;\;\;\frac{\sqrt{b \cdot b + c \cdot \left(-3 \cdot a\right)} - b}{3 \cdot a}\\ \mathbf{elif}\;b \le 4.7524414552463597 \cdot 10^{+86}:\\ \;\;\;\;\frac{3 \cdot \left(c \cdot a\right)}{\left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right) \cdot \left(3 \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Runtime

Time bar (total: 18.2s)Debug logProfile

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