Average Error: 33.3 → 12.0
Time: 27.6s
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.340530591463056 \cdot 10^{+86}:\\ \;\;\;\;\frac{(\frac{3}{2} \cdot \left(\frac{a}{\frac{b}{c}}\right) + \left(b \cdot -2\right))_*}{3 \cdot a}\\ \mathbf{elif}\;b \le 4.0445920374272374 \cdot 10^{-102}:\\ \;\;\;\;\frac{\frac{\sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*} + \left(-b\right)}{3}}{a}\\ \mathbf{elif}\;b \le 3.0303336528790984 \cdot 10^{+119}:\\ \;\;\;\;\frac{\frac{3 \cdot \left(a \cdot c\right)}{\left(\left(-b\right) - \sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*}\right) \cdot 3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}{3 \cdot a}\\ \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.340530591463056e+86

    1. Initial program 43.4

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{3}{2} \cdot \frac{a \cdot c}{b} - 2 \cdot b}}{3 \cdot a}\]
    5. Simplified4.6

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

    if -2.340530591463056e+86 < b < 4.0445920374272374e-102

    1. Initial program 11.8

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

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

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

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

    if 4.0445920374272374e-102 < b < 3.0303336528790984e+119

    1. Initial program 41.5

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

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

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

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

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

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

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

    if 3.0303336528790984e+119 < b

    1. Initial program 59.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.340530591463056 \cdot 10^{+86}:\\ \;\;\;\;\frac{(\frac{3}{2} \cdot \left(\frac{a}{\frac{b}{c}}\right) + \left(b \cdot -2\right))_*}{3 \cdot a}\\ \mathbf{elif}\;b \le 4.0445920374272374 \cdot 10^{-102}:\\ \;\;\;\;\frac{\frac{\sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*} + \left(-b\right)}{3}}{a}\\ \mathbf{elif}\;b \le 3.0303336528790984 \cdot 10^{+119}:\\ \;\;\;\;\frac{\frac{3 \cdot \left(a \cdot c\right)}{\left(\left(-b\right) - \sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*}\right) \cdot 3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}{3 \cdot a}\\ \end{array}\]

Runtime

Time bar (total: 27.6s)Debug logProfile

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