Average Error: 33.0 → 15.9
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} = -\infty:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{if}\;\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le -3.2990153905619118 \cdot 10^{-46}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b}}{\left(-3\right) \cdot a}\\ \mathbf{if}\;\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le -1.3186044156671 \cdot 10^{-312}:\\ \;\;\;\;(e^{\log_* (1 + \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 2.30832132715547 \cdot 10^{-285}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot c}{b \cdot 2}}{\left(-3\right) \cdot a}\\ \mathbf{if}\;\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le 1.0389039396153842 \cdot 10^{+216}:\\ \;\;\;\;\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{\frac{\sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}}{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 5 regimes
  2. if (/ (* (- 1) c) (+ (sqrt (fma (- c) (* 3 a) (* b b))) b)) < -inf.0 or 1.0389039396153842e+216 < (/ (* (- 1) c) (+ (sqrt (fma (- c) (* 3 a) (* b b))) b))

    1. Initial program 0.7

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

      \[\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 associate-/r*0.7

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

    if -inf.0 < (/ (* (- 1) c) (+ (sqrt (fma (- c) (* 3 a) (* b b))) b)) < -3.2990153905619118e-46

    1. Initial program 17.4

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

      \[\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--18.0

      \[\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 simplify5.6

      \[\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-2neg5.6

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

    if -3.2990153905619118e-46 < (/ (* (- 1) c) (+ (sqrt (fma (- c) (* 3 a) (* b b))) b)) < -1.3186044156671e-312

    1. Initial program 30.1

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

      \[\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--30.4

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

      \[\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 expm1-log1p-u13.9

      \[\leadsto \color{blue}{(e^{\log_* (1 + \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 simplify2.4

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

    if -1.3186044156671e-312 < (/ (* (- 1) c) (+ (sqrt (fma (- c) (* 3 a) (* b b))) b)) < 2.30832132715547e-285

    1. Initial program 58.7

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

      \[\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.3

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

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

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

      \[\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 2.30832132715547e-285 < (/ (* (- 1) c) (+ (sqrt (fma (- c) (* 3 a) (* b b))) b)) < 1.0389039396153842e+216

    1. Initial program 23.2

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

      \[\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--24.0

      \[\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 simplify10.1

      \[\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-sqrt10.2

      \[\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 simplify10.0

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

      \[\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}}}\]
  3. Recombined 5 regimes into one program.
  4. Applied simplify15.9

    \[\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} = -\infty:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{if}\;\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le -3.2990153905619118 \cdot 10^{-46}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b}}{\left(-3\right) \cdot a}\\ \mathbf{if}\;\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le -1.3186044156671 \cdot 10^{-312}:\\ \;\;\;\;(e^{\log_* (1 + \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 2.30832132715547 \cdot 10^{-285}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot c}{b \cdot 2}}{\left(-3\right) \cdot a}\\ \mathbf{if}\;\frac{-c}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} + b} \le 1.0389039396153842 \cdot 10^{+216}:\\ \;\;\;\;\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{\frac{\sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \end{array}}\]

Runtime

Time bar (total: 3.7m)Debug logProfile

herbie shell --seed '#(1071852389 864846987 1238109217 3425890003 4124793586 650694553)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))