Average Error: 33.6 → 6.7
Time: 1.6m
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 -1.2473100154318235 \cdot 10^{+154}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le 1.831482572891386 \cdot 10^{-225}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}{a \cdot 3} - \frac{b}{a \cdot 3}\\ \mathbf{elif}\;b \le 1.5450320853015062 \cdot 10^{+145}:\\ \;\;\;\;\frac{-c}{b + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2}}{b} \cdot \frac{c}{3}\\ \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.2473100154318235e+154

    1. Initial program 60.9

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Initial simplification60.9

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

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

    if -1.2473100154318235e+154 < b < 1.831482572891386e-225

    1. Initial program 9.3

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Initial simplification9.3

      \[\leadsto \frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\]
    3. Using strategy rm
    4. Applied div-sub9.3

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

    if 1.831482572891386e-225 < b < 1.5450320853015062e+145

    1. Initial program 37.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Initial simplification37.7

      \[\leadsto \frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\]
    3. Using strategy rm
    4. Applied flip--37.8

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

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

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

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

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

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

    if 1.5450320853015062e+145 < b

    1. Initial program 62.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Initial simplification62.1

      \[\leadsto \frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}\]
    3. Using strategy rm
    4. Applied flip--62.1

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.2473100154318235 \cdot 10^{+154}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le 1.831482572891386 \cdot 10^{-225}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}{a \cdot 3} - \frac{b}{a \cdot 3}\\ \mathbf{elif}\;b \le 1.5450320853015062 \cdot 10^{+145}:\\ \;\;\;\;\frac{-c}{b + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2}}{b} \cdot \frac{c}{3}\\ \end{array}\]

Runtime

Time bar (total: 1.6m)Debug logProfile

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