Average Error: 34.3 → 6.9
Time: 4.9s
Precision: binary64
\[\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 -3.89006540944298138 \cdot 10^{133}:\\ \;\;\;\;\frac{c}{b} \cdot 0.5 - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -9.41814210442427327 \cdot 10^{-298}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a}\\ \mathbf{elif}\;b \le 1.07290354700792347 \cdot 10^{71}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{1.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b < -3.89006540944298138e133

    1. Initial program 57.1

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}}\]
    3. Simplified2.9

      \[\leadsto \color{blue}{\frac{c}{b} \cdot 0.5 - 0.66666666666666663 \cdot \frac{b}{a}}\]

    if -3.89006540944298138e133 < b < -9.41814210442427327e-298

    1. Initial program 9.4

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity9.4

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

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

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

    if -9.41814210442427327e-298 < b < 1.07290354700792347e71

    1. Initial program 31.0

      \[\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-+31.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. Simplified16.7

      \[\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. Simplified16.6

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

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

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

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

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

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

    if 1.07290354700792347e71 < b

    1. Initial program 57.3

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

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

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

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

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

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

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

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

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

      \[\leadsto 1 \cdot \left(1 \cdot \frac{c}{\color{blue}{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}}\right)\]
    13. Simplified3.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -3.89006540944298138 \cdot 10^{133}:\\ \;\;\;\;\frac{c}{b} \cdot 0.5 - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -9.41814210442427327 \cdot 10^{-298}:\\ \;\;\;\;\frac{1}{3} \cdot \frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a}\\ \mathbf{elif}\;b \le 1.07290354700792347 \cdot 10^{71}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{1.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -2}\\ \end{array}\]

Reproduce

herbie shell --seed 2020184 
(FPCore (a b c)
  :name "Cubic critical"
  :precision binary64
  (/ (+ (neg b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))