Average Error: 33.6 → 14.8
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}\;\frac{\frac{-3}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b} \cdot \frac{a \cdot c}{1}}{3 \cdot a} \le -4.0989970764523513 \cdot 10^{+155}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{if}\;\frac{\frac{-3}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b} \cdot \frac{a \cdot c}{1}}{3 \cdot a} \le -1.9684654483002747 \cdot 10^{-225}:\\ \;\;\;\;\frac{\frac{-3}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b} \cdot \frac{a \cdot c}{1}}{3 \cdot a}\\ \mathbf{if}\;\frac{\frac{-3}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b} \cdot \frac{a \cdot c}{1}}{3 \cdot a} \le 0.0:\\ \;\;\;\;\frac{-c}{b + b}\\ \mathbf{if}\;\frac{\frac{-3}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b} \cdot \frac{a \cdot c}{1}}{3 \cdot a} \le 3.719520127329433 \cdot 10^{+225}:\\ \;\;\;\;\frac{\frac{-3}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b} \cdot \frac{a \cdot c}{1}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(3 \cdot a\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 3 regimes
  2. if (/ (* (/ (* c a) 1) (/ (- 3) (+ (sqrt (fma (* 3 a) (- c) (* b b))) b))) (* 3 a)) < -4.0989970764523513e+155 or 3.719520127329433e+225 < (/ (* (/ (* c a) 1) (/ (- 3) (+ (sqrt (fma (* 3 a) (- c) (* b b))) b))) (* 3 a))

    1. Initial program 23.0

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

      \[\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*23.0

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

    if -4.0989970764523513e+155 < (/ (* (/ (* c a) 1) (/ (- 3) (+ (sqrt (fma (* 3 a) (- c) (* b b))) b))) (* 3 a)) < -1.9684654483002747e-225 or 0.0 < (/ (* (/ (* c a) 1) (/ (- 3) (+ (sqrt (fma (* 3 a) (- c) (* b b))) b))) (* 3 a)) < 3.719520127329433e+225

    1. Initial program 18.6

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify18.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--19.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 simplify1.7

      \[\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 *-un-lft-identity1.7

      \[\leadsto \frac{\frac{\left(c \cdot a\right) \cdot \left(-3\right)}{\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}\]
    8. Applied times-frac1.7

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

    if -1.9684654483002747e-225 < (/ (* (/ (* c a) 1) (/ (- 3) (+ (sqrt (fma (* 3 a) (- c) (* b b))) b))) (* 3 a)) < 0.0

    1. Initial program 56.5

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

      \[\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--57.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 simplify43.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. Taylor expanded around 0 32.3

      \[\leadsto \frac{\frac{\left(c \cdot a\right) \cdot \left(-3\right)}{\color{blue}{b} + b}}{3 \cdot a}\]
    7. Applied simplify20.8

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\frac{\frac{-3}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b} \cdot \frac{a \cdot c}{1}}{3 \cdot a} \le -4.0989970764523513 \cdot 10^{+155}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{if}\;\frac{\frac{-3}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b} \cdot \frac{a \cdot c}{1}}{3 \cdot a} \le -1.9684654483002747 \cdot 10^{-225}:\\ \;\;\;\;\frac{\frac{-3}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b} \cdot \frac{a \cdot c}{1}}{3 \cdot a}\\ \mathbf{if}\;\frac{\frac{-3}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b} \cdot \frac{a \cdot c}{1}}{3 \cdot a} \le 0.0:\\ \;\;\;\;\frac{-c}{b + b}\\ \mathbf{if}\;\frac{\frac{-3}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b} \cdot \frac{a \cdot c}{1}}{3 \cdot a} \le 3.719520127329433 \cdot 10^{+225}:\\ \;\;\;\;\frac{\frac{-3}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b} \cdot \frac{a \cdot c}{1}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \end{array}}\]

Runtime

Time bar (total: 3.2m)Debug logProfile

herbie shell --seed '#(1070864556 424010669 783715395 1203517814 4070606583 4107618214)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))