Average Error: 33.5 → 10.7
Time: 6.4m
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{3}{2}}{b} \le -2.6473673536637616 \cdot 10^{+17}:\\ \;\;\;\;\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}\\ \mathbf{if}\;\frac{-\frac{3}{2}}{b} \le 8.91782633481956 \cdot 10^{-282}:\\ \;\;\;\;\frac{c}{\left(\left(-b\right) - b\right) + \frac{\frac{3}{2} \cdot c}{\frac{b}{a}}}\\ \mathbf{if}\;\frac{-\frac{3}{2}}{b} \le 3.4927764008886804 \cdot 10^{-79}:\\ \;\;\;\;\frac{\frac{\frac{3}{2} \cdot a}{\frac{b}{c}} - \left(b + b\right)}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*} - b}}{3} \cdot \frac{\sqrt{\sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*} - b}}{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 (/ (- 3/2) b) < -2.6473673536637616e+17

    1. Initial program 24.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 flip-+24.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 simplify18.3

      \[\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.6473673536637616e+17 < (/ (- 3/2) b) < 8.91782633481956e-282

    1. Initial program 54.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-+54.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 simplify26.8

      \[\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-exp-log27.9

      \[\leadsto \frac{\frac{c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \color{blue}{e^{\log \left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}}{3 \cdot a}\]
    7. Taylor expanded around inf 20.7

      \[\leadsto \frac{\frac{c \cdot \left(a \cdot 3\right)}{\left(-b\right) - e^{\log \color{blue}{\left(b - \frac{3}{2} \cdot \frac{c \cdot a}{b}\right)}}}}{3 \cdot a}\]
    8. Applied simplify9.2

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

    if 8.91782633481956e-282 < (/ (- 3/2) b) < 3.4927764008886804e-79

    1. Initial program 39.4

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

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

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

    if 3.4927764008886804e-79 < (/ (- 3/2) b)

    1. Initial program 9.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 add-sqr-sqrt9.9

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

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

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

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

Runtime

Time bar (total: 6.4m)Debug logProfile

herbie shell --seed '#(1072967564 1937075727 894099792 790700740 1036514779 1027793188)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))