Average Error: 33.4 → 8.5
Time: 21.8s
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 -2.655088126483261 \cdot 10^{+86}:\\ \;\;\;\;(\frac{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 6.77405814712691 \cdot 10^{-205}:\\ \;\;\;\;\frac{\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*} - b}{a \cdot 3}\\ \mathbf{elif}\;b \le 1.8920130318297846 \cdot 10^{+47}:\\ \;\;\;\;\frac{\frac{\left(a \cdot -3\right) \cdot c}{a \cdot 3}}{\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*} + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \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 < -2.655088126483261e+86

    1. Initial program 42.0

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

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

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

    if -2.655088126483261e+86 < b < 6.77405814712691e-205

    1. Initial program 10.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*10.6

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

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

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

    if 6.77405814712691e-205 < b < 1.8920130318297846e+47

    1. Initial program 33.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 associate-/r*33.4

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

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

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

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

      \[\leadsto \color{blue}{\frac{\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))_*} - b \cdot b}{\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*} + b}} \cdot \frac{1}{a \cdot 3}\]
    11. Applied associate-*l/33.5

      \[\leadsto \color{blue}{\frac{\left(\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))_*} - b \cdot b\right) \cdot \frac{1}{a \cdot 3}}{\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*} + b}}\]
    12. Simplified15.7

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

    if 1.8920130318297846e+47 < b

    1. Initial program 56.5

      \[\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*56.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.655088126483261 \cdot 10^{+86}:\\ \;\;\;\;(\frac{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 6.77405814712691 \cdot 10^{-205}:\\ \;\;\;\;\frac{\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*} - b}{a \cdot 3}\\ \mathbf{elif}\;b \le 1.8920130318297846 \cdot 10^{+47}:\\ \;\;\;\;\frac{\frac{\left(a \cdot -3\right) \cdot c}{a \cdot 3}}{\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*} + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \end{array}\]

Runtime

Time bar (total: 21.8s)Debug logProfile

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