Average Error: 33.6 → 6.8
Time: 2.6m
Precision: 64
Internal Precision: 3456
\[\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.021796851989845 \cdot 10^{+109}:\\ \;\;\;\;\frac{\frac{a}{b} \cdot \left(\frac{3}{2} \cdot c\right) - \left(b + b\right)}{3 \cdot a}\\ \mathbf{if}\;b \le 9.51695945588628 \cdot 10^{-220}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} - b}{3}}{a}\\ \mathbf{if}\;b \le 1.6209575952638073 \cdot 10^{+120}:\\ \;\;\;\;\left(\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}} \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}\right) \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{\frac{3}{2} \cdot c}{\frac{b}{a}} - 2 \cdot b}\\ \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.021796851989845e+109

    1. Initial program 46.7

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(\frac{3}{2} \cdot \frac{c \cdot a}{b} - b\right)}}{3 \cdot a}\]
    3. Applied simplify3.9

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

    if -1.021796851989845e+109 < b < 9.51695945588628e-220

    1. Initial program 9.8

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

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

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

    if 9.51695945588628e-220 < b < 1.6209575952638073e+120

    1. Initial program 36.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 flip-+36.6

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    4. Applied simplify16.1

      \[\leadsto \frac{\frac{\color{blue}{c \cdot \left(a \cdot 3\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt16.8

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{\frac{c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}} \cdot \sqrt[3]{\frac{\frac{c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}}\right) \cdot \sqrt[3]{\frac{\frac{c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}}}\]
    7. Applied simplify16.7

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}} \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}\right)} \cdot \sqrt[3]{\frac{\frac{c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}}\]
    8. Applied simplify8.5

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

    if 1.6209575952638073e+120 < b

    1. Initial program 60.0

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied flip-+60.1

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    4. Applied simplify33.9

      \[\leadsto \frac{\frac{\color{blue}{c \cdot \left(a \cdot 3\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Taylor expanded around inf 13.1

      \[\leadsto \frac{\frac{c \cdot \left(a \cdot 3\right)}{\color{blue}{\frac{3}{2} \cdot \frac{c \cdot a}{b} - 2 \cdot b}}}{3 \cdot a}\]
    6. Applied simplify1.7

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

Runtime

Time bar (total: 2.6m)Debug logProfile

herbie shell --seed '#(1070864556 424010669 783715395 1203517814 4070606583 4107618214)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))