Average Error: 34.0 → 6.7
Time: 4.7s
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 -8.1455971762038981 \cdot 10^{152}:\\ \;\;\;\;\frac{\frac{\left(a \cdot \left(c \cdot \frac{1.5}{b}\right) - b\right) - b}{3}}{a}\\ \mathbf{elif}\;b \le -3.3499841613852864 \cdot 10^{-230}:\\ \;\;\;\;\frac{1}{3 \cdot \frac{a}{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}}\\ \mathbf{elif}\;b \le 8.28334187299857958 \cdot 10^{116}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\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 < -8.1455971762038981e152

    1. Initial program 63.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 associate-/r*63.2

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

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

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

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

    if -8.1455971762038981e152 < b < -3.3499841613852864e-230

    1. Initial program 7.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 clear-num7.8

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

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

    if -3.3499841613852864e-230 < b < 8.28334187299857958e116

    1. Initial program 31.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-+31.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.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.6

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

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

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

      \[\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 8.28334187299857958e116 < 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. Taylor expanded around inf 2.4

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -8.1455971762038981 \cdot 10^{152}:\\ \;\;\;\;\frac{\frac{\left(a \cdot \left(c \cdot \frac{1.5}{b}\right) - b\right) - b}{3}}{a}\\ \mathbf{elif}\;b \le -3.3499841613852864 \cdot 10^{-230}:\\ \;\;\;\;\frac{1}{3 \cdot \frac{a}{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}}\\ \mathbf{elif}\;b \le 8.28334187299857958 \cdot 10^{116}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \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)))