Average Error: 33.4 → 8.9
Time: 3.2m
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 -3.759852933912212 \cdot 10^{+153}:\\ \;\;\;\;\frac{\frac{\frac{3}{2} \cdot a}{\frac{b}{c}} - \left(b + b\right)}{3 \cdot a}\\ \mathbf{if}\;b \le -2.315050446741968 \cdot 10^{-308}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a}\\ \mathbf{if}\;b \le 8.510116380805124 \cdot 10^{+33}:\\ \;\;\;\;\frac{\frac{3 \cdot \left(a \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{\frac{-3}{2}}{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 b < -3.759852933912212e+153

    1. Initial program 60.5

      \[\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-inv60.5

      \[\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}}\]
    4. Taylor expanded around -inf 11.0

      \[\leadsto \color{blue}{\left(\frac{3}{2} \cdot \frac{c \cdot a}{b} - 2 \cdot b\right)} \cdot \frac{1}{3 \cdot a}\]
    5. Applied simplify2.0

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

    if -3.759852933912212e+153 < b < -2.315050446741968e-308

    1. Initial program 9.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-identity9.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-frac9.1

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

    if -2.315050446741968e-308 < b < 8.510116380805124e+33

    1. Initial program 27.3

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

      \[\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}{3 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]

    if 8.510116380805124e+33 < 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. 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}{\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}}\]
  3. Recombined 4 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 3.2m)Debug log

herbie shell --seed '#(3134395454 2560787729 2839617794 3603201618 2404842889 1897446260)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))