Average Error: 33.5 → 8.0
Time: 1.5m
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}\;b \le -1.3303061683842245 \cdot 10^{+154}:\\ \;\;\;\;\frac{-c}{\frac{\frac{-3}{2}}{\frac{-1}{c}} \cdot \frac{\frac{-1}{b}}{\frac{-1}{a}}}\\ \mathbf{elif}\;b \le 4.879117888011816 \cdot 10^{-295}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a}\\ \mathbf{elif}\;b \le 2.2363902485940985 \cdot 10^{+126}:\\ \;\;\;\;\frac{-c}{b + \sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b + b}\\ \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 b < -1.3303061683842245e+154

    1. Initial program 61.0

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

      \[\leadsto \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--62.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 associate-/l/62.4

      \[\leadsto \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}{\left(3 \cdot a\right) \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b\right)}}\]
    6. Simplified62.5

      \[\leadsto \frac{\color{blue}{\left(-c\right) \cdot \left(3 \cdot a\right)}}{\left(3 \cdot a\right) \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b\right)}\]
    7. Using strategy rm
    8. Applied distribute-lft-neg-out62.5

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

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

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

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

      \[\leadsto -\frac{c}{\color{blue}{e^{\left(\log \left(\frac{-1}{b}\right) + \log \frac{-3}{2}\right) - \left(\log \left(\frac{-1}{c}\right) + \log \left(\frac{-1}{a}\right)\right)}}}\]
    14. Simplified13.5

      \[\leadsto -\frac{c}{\color{blue}{\frac{\frac{-1}{b}}{\frac{-1}{a}} \cdot \frac{\frac{-3}{2}}{\frac{-1}{c}}}}\]

    if -1.3303061683842245e+154 < b < 4.879117888011816e-295

    1. Initial program 9.2

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

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

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

      \[\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 4.879117888011816e-295 < b < 2.2363902485940985e+126

    1. Initial program 33.9

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

      \[\leadsto \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--34.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 associate-/l/37.9

      \[\leadsto \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}{\left(3 \cdot a\right) \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b\right)}}\]
    6. Simplified19.8

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

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

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

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

    if 2.2363902485940985e+126 < b

    1. Initial program 60.6

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

      \[\leadsto \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--60.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 associate-/l/60.7

      \[\leadsto \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}{\left(3 \cdot a\right) \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b\right)}}\]
    6. Simplified34.8

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

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

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

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

      \[\leadsto -\frac{c}{b + \color{blue}{b}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification8.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.3303061683842245 \cdot 10^{+154}:\\ \;\;\;\;\frac{-c}{\frac{\frac{-3}{2}}{\frac{-1}{c}} \cdot \frac{\frac{-1}{b}}{\frac{-1}{a}}}\\ \mathbf{elif}\;b \le 4.879117888011816 \cdot 10^{-295}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a}\\ \mathbf{elif}\;b \le 2.2363902485940985 \cdot 10^{+126}:\\ \;\;\;\;\frac{-c}{b + \sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b + b}\\ \end{array}\]

Runtime

Time bar (total: 1.5m)Debug logProfile

herbie shell --seed 2018216 +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))