Average Error: 33.6 → 10.4
Time: 2.1m
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}\;\frac{\frac{\frac{-3}{2}}{b}}{3} \le -2.499194702845655 \cdot 10^{-90}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}}{a \cdot 3}\\ \mathbf{if}\;\frac{\frac{\frac{-3}{2}}{b}}{3} \le 1.5183084991300792 \cdot 10^{-296}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}\\ \mathbf{if}\;\frac{\frac{\frac{-3}{2}}{b}}{3} \le 5140777790.445132:\\ \;\;\;\;\frac{\frac{\frac{3}{2} \cdot a}{\frac{b}{c}} - 2 \cdot b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} + \left(-b\right)\right) \cdot \frac{1}{a \cdot 3}\\ \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 (/ (/ -3/2 b) 3) < -2.499194702845655e-90

    1. Initial program 32.4

      \[\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-+32.5

      \[\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.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}\]

    if -2.499194702845655e-90 < (/ (/ -3/2 b) 3) < 1.5183084991300792e-296

    1. Initial program 58.1

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

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

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

    if 1.5183084991300792e-296 < (/ (/ -3/2 b) 3) < 5140777790.445132

    1. Initial program 30.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 *-un-lft-identity30.0

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

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

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

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

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

    if 5140777790.445132 < (/ (/ -3/2 b) 3)

    1. Initial program 9.7

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

      \[\leadsto \color{blue}{\left(\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right) \cdot \frac{1}{3 \cdot a}}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify10.4

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\frac{\frac{\frac{-3}{2}}{b}}{3} \le -2.499194702845655 \cdot 10^{-90}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}}{a \cdot 3}\\ \mathbf{if}\;\frac{\frac{\frac{-3}{2}}{b}}{3} \le 1.5183084991300792 \cdot 10^{-296}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}\\ \mathbf{if}\;\frac{\frac{\frac{-3}{2}}{b}}{3} \le 5140777790.445132:\\ \;\;\;\;\frac{\frac{\frac{3}{2} \cdot a}{\frac{b}{c}} - 2 \cdot b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} + \left(-b\right)\right) \cdot \frac{1}{a \cdot 3}\\ \end{array}}\]

Runtime

Time bar (total: 2.1m)Debug logProfile

herbie shell --seed '#(1071373924 2949776965 1885069702 3247780810 90874544 2263903749)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))