Average Error: 33.2 → 14.5
Time: 1.7m
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{\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}}{a} \le -2.885941081556225 \cdot 10^{+54}:\\ \;\;\;\;\frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{3 \cdot a}\\ \mathbf{if}\;\frac{\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}}{a} \le -1.0567334562238754 \cdot 10^{-292}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot \left(-c\right)}{a \cdot 3}}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}\\ \mathbf{if}\;\frac{\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}}{a} \le 0.0:\\ \;\;\;\;\frac{\frac{c}{-2}}{b}\\ \mathbf{if}\;\frac{\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}}{a} \le 1.1312373743710137 \cdot 10^{+269}:\\ \;\;\;\;\frac{\frac{\left(a \cdot 3\right) \cdot \left(-c\right)}{a \cdot 3}}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}\\ \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 4 regimes
  2. if (/ (/ (/ (* (* c a) (- 3)) (+ (sqrt (fma (* 3 a) (- c) (* b b))) b)) 3) a) < -2.885941081556225e+54

    1. Initial program 6.4

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

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

    if -2.885941081556225e+54 < (/ (/ (/ (* (* c a) (- 3)) (+ (sqrt (fma (* 3 a) (- c) (* b b))) b)) 3) a) < -1.0567334562238754e-292 or 0.0 < (/ (/ (/ (* (* c a) (- 3)) (+ (sqrt (fma (* 3 a) (- c) (* b b))) b)) 3) a) < 1.1312373743710137e+269

    1. Initial program 19.0

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

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

      \[\leadsto \frac{1}{\frac{3 \cdot a}{\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}}}}\]
    7. Applied associate-/r/19.7

      \[\leadsto \frac{1}{\color{blue}{\frac{3 \cdot a}{\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} \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b\right)}}\]
    8. Applied associate-/r*19.7

      \[\leadsto \color{blue}{\frac{\frac{1}{\frac{3 \cdot a}{\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}}\]
    9. Applied simplify1.2

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

    if -1.0567334562238754e-292 < (/ (/ (/ (* (* c a) (- 3)) (+ (sqrt (fma (* 3 a) (- c) (* b b))) b)) 3) a) < 0.0

    1. Initial program 57.3

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-2 \cdot \frac{b}{c}}}\]
    6. Applied simplify19.7

      \[\leadsto \color{blue}{\frac{\frac{c}{-2}}{b}}\]

    if 1.1312373743710137e+269 < (/ (/ (/ (* (* c a) (- 3)) (+ (sqrt (fma (* 3 a) (- c) (* b b))) b)) 3) a)

    1. Initial program 32.5

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify32.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 associate-/r*32.5

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

Runtime

Time bar (total: 1.7m)Debug logProfile

herbie shell --seed '#(1070706311 3771791028 4128836681 4194990999 2341756049 504035650)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))