Average Error: 34.1 → 6.8
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}\;b \le -4.3390913484397713 \cdot 10^{+145}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 2.28856794650671 \cdot 10^{-296}:\\ \;\;\;\;\frac{1}{\frac{3 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}\\ \mathbf{if}\;b \le 6.975841181722501 \cdot 10^{+127}:\\ \;\;\;\;\frac{3}{3} \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{\frac{3}{2} \cdot a}{\frac{b}{c}} - \left(b + b\right)}\\ \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 < -4.3390913484397713e+145

    1. Initial program 57.5

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Taylor expanded around -inf 2.7

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

    if -4.3390913484397713e+145 < b < 2.28856794650671e-296

    1. Initial program 10.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied clear-num10.2

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

    if 2.28856794650671e-296 < b < 6.975841181722501e+127

    1. Initial program 33.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied flip-+33.8

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

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

      \[\leadsto \frac{\frac{3 \cdot \left(a \cdot c\right)}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}{3 \cdot a}\]
    7. Applied times-frac15.9

      \[\leadsto \frac{\color{blue}{\frac{3}{1} \cdot \frac{a \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    8. Applied times-frac15.7

      \[\leadsto \color{blue}{\frac{\frac{3}{1}}{3} \cdot \frac{\frac{a \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{a}}\]
    9. Applied simplify15.7

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

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

    if 6.975841181722501e+127 < b

    1. Initial program 60.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied flip-+60.2

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    4. Applied simplify33.9

      \[\leadsto \frac{\frac{\color{blue}{3 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity33.9

      \[\leadsto \frac{\frac{3 \cdot \left(a \cdot c\right)}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}{3 \cdot a}\]
    7. Applied times-frac33.9

      \[\leadsto \frac{\color{blue}{\frac{3}{1} \cdot \frac{a \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    8. Applied times-frac33.9

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

      \[\leadsto \color{blue}{\frac{3}{3}} \cdot \frac{\frac{a \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{a}\]
    10. Applied simplify33.1

      \[\leadsto \frac{3}{3} \cdot \color{blue}{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3}}}\]
    11. Taylor expanded around inf 5.5

      \[\leadsto \frac{3}{3} \cdot \frac{c}{\color{blue}{\frac{3}{2} \cdot \frac{c \cdot a}{b} - 2 \cdot b}}\]
    12. Applied simplify1.6

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

Runtime

Time bar (total: 1.7m)Debug log

herbie shell --seed '#(4187538376 1520029361 2786545844 1568991248 4244367449 2261141537)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))