Average Error: 34.4 → 6.8
Time: 2.4m
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{b}{\frac{-3}{2}} \le -1.1215798919922517 \cdot 10^{+126}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \mathbf{if}\;\frac{b}{\frac{-3}{2}} \le 9.353121169670643 \cdot 10^{-306}:\\ \;\;\;\;c \cdot \frac{1}{\left(-b\right) - \sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\\ \mathbf{if}\;\frac{b}{\frac{-3}{2}} \le 2.586818699748715 \cdot 10^{+67}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(-c\right) \cdot \left(a \cdot 3\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b}{\frac{-3}{2}}}{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 (/ b -3/2) < -1.1215798919922517e+126

    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.4

      \[\leadsto \frac{\frac{\color{blue}{\left(3 \cdot c\right) \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied clear-num33.4

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

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

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

    if -1.1215798919922517e+126 < (/ b -3/2) < 9.353121169670643e-306

    1. Initial program 33.9

      \[\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-+34.0

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

      \[\leadsto \frac{\frac{\color{blue}{\left(3 \cdot c\right) \cdot a}}{\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-identity16.8

      \[\leadsto \frac{\frac{\left(3 \cdot c\right) \cdot a}{\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.6

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

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

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

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

    if 9.353121169670643e-306 < (/ b -3/2) < 2.586818699748715e+67

    1. Initial program 9.8

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied associate-/r*9.8

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

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

    if 2.586818699748715e+67 < (/ b -3/2)

    1. Initial program 40.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-+61.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 simplify61.2

      \[\leadsto \frac{\frac{\color{blue}{\left(3 \cdot c\right) \cdot a}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied clear-num61.3

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{b}{\frac{-3}{2}}}{a}}\]
  3. Recombined 4 regimes into one program.

Runtime

Time bar (total: 2.4m)Debug logProfile

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