Average Error: 34.6 → 6.9
Time: 5.1s
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 -5.9828724512656899 \cdot 10^{153}:\\ \;\;\;\;\frac{1.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -2}{a \cdot 3}\\ \mathbf{elif}\;b \le -2.3194196282826912 \cdot 10^{-305}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}{a \cdot 3}\\ \mathbf{elif}\;b \le 2.5626360877386485 \cdot 10^{102}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \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 < -5.9828724512656899e153

    1. Initial program 63.9

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

      \[\leadsto \frac{\color{blue}{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}}{3 \cdot a}\]
    3. Simplified2.7

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

    if -5.9828724512656899e153 < b < -2.3194196282826912e-305

    1. Initial program 9.4

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

    if -2.3194196282826912e-305 < b < 2.5626360877386485e102

    1. Initial program 32.2

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

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

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

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

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

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

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

      \[\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 2.5626360877386485e102 < b

    1. Initial program 59.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}{-0.5 \cdot \frac{c}{b}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -5.9828724512656899 \cdot 10^{153}:\\ \;\;\;\;\frac{1.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -2}{a \cdot 3}\\ \mathbf{elif}\;b \le -2.3194196282826912 \cdot 10^{-305}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}{a \cdot 3}\\ \mathbf{elif}\;b \le 2.5626360877386485 \cdot 10^{102}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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