Average Error: 33.4 → 17.4
Time: 3.7m
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{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le -9.829097344954686:\\ \;\;\;\;\frac{\sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a} \cdot \frac{1}{3}\\ \mathbf{if}\;\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le -2.907938906946742 \cdot 10^{-273}:\\ \;\;\;\;\log_* (1 + (e^{\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b}} - 1)^*)\\ \mathbf{if}\;\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le 1.2122845735971426 \cdot 10^{-290}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot c}{2 \cdot b}}{-a \cdot 3}\\ \mathbf{if}\;\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le 4.884602005091628 \cdot 10^{+172}:\\ \;\;\;\;\sqrt{\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b}} \cdot \sqrt{\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} + \left(-b\right)}{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 5 regimes
  2. if (/ (* (- 1) c) (+ (sqrt (fma (- c) (* 3 a) (* b b))) b)) < -9.829097344954686

    1. Initial program 8.8

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

      \[\leadsto \color{blue}{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity8.8

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

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

    if -9.829097344954686 < (/ (* (- 1) c) (+ (sqrt (fma (- c) (* 3 a) (* b b))) b)) < -2.907938906946742e-273

    1. Initial program 26.9

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\left(c \cdot a\right) \cdot \left(-3\right)}}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}{3 \cdot a}\]
    6. Using strategy rm
    7. Applied log1p-expm1-u12.3

      \[\leadsto \color{blue}{\log_* (1 + (e^{\frac{\frac{\left(c \cdot a\right) \cdot \left(-3\right)}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}{3 \cdot a}} - 1)^*)}\]
    8. Applied simplify3.8

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

    if -2.907938906946742e-273 < (/ (* (- 1) c) (+ (sqrt (fma (- c) (* 3 a) (* b b))) b)) < 1.2122845735971426e-290

    1. Initial program 58.6

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\left(c \cdot a\right) \cdot \left(-3\right)}}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}{3 \cdot a}\]
    6. Using strategy rm
    7. Applied frac-2neg47.4

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

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

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

    if 1.2122845735971426e-290 < (/ (* (- 1) c) (+ (sqrt (fma (- c) (* 3 a) (* b b))) b)) < 4.884602005091628e+172

    1. Initial program 25.9

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\left(c \cdot a\right) \cdot \left(-3\right)}}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}{3 \cdot a}\]
    6. Using strategy rm
    7. Applied add-sqr-sqrt11.4

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

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

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

    if 4.884602005091628e+172 < (/ (* (- 1) c) (+ (sqrt (fma (- c) (* 3 a) (* b b))) b))

    1. Initial program 2.3

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
  3. Recombined 5 regimes into one program.
  4. Applied simplify17.4

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le -9.829097344954686:\\ \;\;\;\;\frac{\sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a} \cdot \frac{1}{3}\\ \mathbf{if}\;\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le -2.907938906946742 \cdot 10^{-273}:\\ \;\;\;\;\log_* (1 + (e^{\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b}} - 1)^*)\\ \mathbf{if}\;\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le 1.2122845735971426 \cdot 10^{-290}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot c}{2 \cdot b}}{-a \cdot 3}\\ \mathbf{if}\;\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le 4.884602005091628 \cdot 10^{+172}:\\ \;\;\;\;\sqrt{\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b}} \cdot \sqrt{\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} + \left(-b\right)}{a \cdot 3}\\ \end{array}}\]

Runtime

Time bar (total: 3.7m)Debug logProfile

herbie shell --seed '#(1071119240 1686926585 3481876196 78132896 2080707795 3185793749)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))