Average Error: 34.0 → 9.2
Time: 25.3s
Precision: 64
Internal Precision: 128
\[\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 -6.091631583032234 \cdot 10^{+102}:\\ \;\;\;\;(\frac{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 1.2544827001437557 \cdot 10^{-157}:\\ \;\;\;\;\frac{\sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} - b}{a \cdot 3}\\ \mathbf{elif}\;b \le 7.674036518841756 \cdot 10^{+43}:\\ \;\;\;\;\frac{\frac{\left(c \cdot a\right) \cdot 3}{\left(\left(-b\right) - \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}\right) \cdot 3}}{a}\\ \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 < -6.091631583032234e+102

    1. Initial program 46.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*46.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 0 46.9

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

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

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

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

    if -6.091631583032234e+102 < b < 1.2544827001437557e-157

    1. Initial program 11.4

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

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

    if 1.2544827001437557e-157 < b < 7.674036518841756e+43

    1. Initial program 37.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*37.1

      \[\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 0 37.1

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

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

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

      \[\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. Simplified17.9

      \[\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 7.674036518841756e+43 < b

    1. Initial program 56.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -6.091631583032234 \cdot 10^{+102}:\\ \;\;\;\;(\frac{-2}{3} \cdot \left(\frac{b}{a}\right) + \left(\frac{c}{\frac{b}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b \le 1.2544827001437557 \cdot 10^{-157}:\\ \;\;\;\;\frac{\sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} - b}{a \cdot 3}\\ \mathbf{elif}\;b \le 7.674036518841756 \cdot 10^{+43}:\\ \;\;\;\;\frac{\frac{\left(c \cdot a\right) \cdot 3}{\left(\left(-b\right) - \sqrt{(\left(a \cdot -3\right) \cdot c + \left(b \cdot b\right))_*}\right) \cdot 3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{-1}{2}\\ \end{array}\]

Runtime

Time bar (total: 25.3s)Debug logProfile

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