Average Error: 33.7 → 8.5
Time: 31.7s
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 -1.6071402748164945 \cdot 10^{+138}:\\ \;\;\;\;\frac{(-2 \cdot b + \left(\left(a \cdot c\right) \cdot \frac{\frac{3}{2}}{b}\right))_*}{3 \cdot a}\\ \mathbf{elif}\;b \le -1.03372462536524 \cdot 10^{-310}:\\ \;\;\;\;\frac{\frac{\sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{elif}\;b \le 1.7480250552565296 \cdot 10^{+65}:\\ \;\;\;\;\frac{-3}{b + \sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*}} \cdot \left(c \cdot \frac{1}{3}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-3}{b + b} \cdot \left(c \cdot \frac{1}{3}\right)\\ \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.6071402748164945e+138

    1. Initial program 55.7

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

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

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

    if -1.6071402748164945e+138 < b < -1.03372462536524e-310

    1. Initial program 9.3

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

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

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

    if -1.03372462536524e-310 < b < 1.7480250552565296e+65

    1. Initial program 31.0

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

      \[\leadsto \frac{\sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} - b}{3 \cdot a}\]
    3. Using strategy rm
    4. Applied flip--31.2

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

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

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

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

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

    if 1.7480250552565296e+65 < b

    1. Initial program 56.4

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

      \[\leadsto \frac{\sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} - b}{3 \cdot a}\]
    3. Using strategy rm
    4. Applied flip--56.4

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot c\right)} \cdot \frac{-3}{\sqrt{(-3 \cdot \left(c \cdot a\right) + \left(b \cdot b\right))_*} + b}\]
    10. Taylor expanded around 0 4.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.6071402748164945 \cdot 10^{+138}:\\ \;\;\;\;\frac{(-2 \cdot b + \left(\left(a \cdot c\right) \cdot \frac{\frac{3}{2}}{b}\right))_*}{3 \cdot a}\\ \mathbf{elif}\;b \le -1.03372462536524 \cdot 10^{-310}:\\ \;\;\;\;\frac{\frac{\sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{elif}\;b \le 1.7480250552565296 \cdot 10^{+65}:\\ \;\;\;\;\frac{-3}{b + \sqrt{(-3 \cdot \left(a \cdot c\right) + \left(b \cdot b\right))_*}} \cdot \left(c \cdot \frac{1}{3}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-3}{b + b} \cdot \left(c \cdot \frac{1}{3}\right)\\ \end{array}\]

Runtime

Time bar (total: 31.7s)Debug logProfile

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