Average Error: 33.4 → 8.9
Time: 19.6s
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{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 9.853261051747485 \cdot 10^{-117}:\\ \;\;\;\;\frac{\sqrt{(\left(-3 \cdot a\right) \cdot c + \left(b \cdot b\right))_*} + \left(-b\right)}{a \cdot 3}\\ \mathbf{elif}\;b \le 2.4259893438094626 \cdot 10^{+83}:\\ \;\;\;\;\frac{\frac{\left(c \cdot a\right) \cdot 3}{3 \cdot \left(\left(-b\right) - \sqrt{(\left(-3 \cdot a\right) \cdot c + \left(b \cdot b\right))_*}\right)}}{a}\\ \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

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 58.9

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied associate-/r*58.8

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

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

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

    if -1.9917452429919785e+149 < b < 9.853261051747485e-117

    1. Initial program 11.3

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

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

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

    if 9.853261051747485e-117 < b < 2.4259893438094626e+83

    1. Initial program 40.3

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied associate-/r*40.3

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

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

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*} \cdot \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}{3 \cdot \left(\left(-b\right) - \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}\right)}}}{a}\]
    9. Simplified15.7

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

    if 2.4259893438094626e+83 < b

    1. Initial program 58.0

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied associate-/r*58.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.9917452429919785 \cdot 10^{+149}:\\ \;\;\;\;(\frac{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 9.853261051747485 \cdot 10^{-117}:\\ \;\;\;\;\frac{\sqrt{(\left(-3 \cdot a\right) \cdot c + \left(b \cdot b\right))_*} + \left(-b\right)}{a \cdot 3}\\ \mathbf{elif}\;b \le 2.4259893438094626 \cdot 10^{+83}:\\ \;\;\;\;\frac{\frac{\left(c \cdot a\right) \cdot 3}{3 \cdot \left(\left(-b\right) - \sqrt{(\left(-3 \cdot a\right) \cdot c + \left(b \cdot b\right))_*}\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}\]

Runtime

Time bar (total: 19.6s)Debug logProfile

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