Average Error: 33.0 → 10.2
Time: 17.2s
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.7570560333088676 \cdot 10^{+134}:\\ \;\;\;\;(\frac{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 1.701885057653478 \cdot 10^{-61}:\\ \;\;\;\;\frac{\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*} - b}{a \cdot 3}\\ \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 3 regimes
  2. if b < -1.7570560333088676e+134

    1. Initial program 53.4

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

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

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

    if -1.7570560333088676e+134 < b < 1.701885057653478e-61

    1. Initial program 13.1

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

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

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

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

    if 1.701885057653478e-61 < b

    1. Initial program 52.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.7570560333088676 \cdot 10^{+134}:\\ \;\;\;\;(\frac{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 1.701885057653478 \cdot 10^{-61}:\\ \;\;\;\;\frac{\sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \end{array}\]

Runtime

Time bar (total: 17.2s)Debug logProfile

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