Average Error: 34.3 → 14.3
Time: 6.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 -6.2318633362822913 \cdot 10^{107}:\\ \;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le 2.93197497284158803 \cdot 10^{-107}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;b \le 7790440143226900:\\ \;\;\;\;\frac{3 \cdot \left(a \cdot c\right)}{3 \cdot \left({\left(-b\right)}^{3} - {\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}^{3}\right)} \cdot \left(\frac{{b}^{2} + \left(b \cdot b - \left(3 \cdot a\right) \cdot c\right)}{a} - \frac{b \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{3 \cdot \left(a \cdot c\right)}{3 \cdot \left(\left(-b\right) - \left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)\right)}}{a}\\ \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 < -6.2318633362822913e107

    1. Initial program 49.4

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

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

    if -6.2318633362822913e107 < b < 2.93197497284158803e-107

    1. Initial program 12.3

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

    if 2.93197497284158803e-107 < b < 7790440143226900

    1. Initial program 39.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-+39.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. Simplified17.3

      \[\leadsto \frac{\frac{\color{blue}{0 + 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 flip3--20.4

      \[\leadsto \frac{\frac{0 + 3 \cdot \left(a \cdot c\right)}{\color{blue}{\frac{{\left(-b\right)}^{3} - {\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}^{3}}{\left(-b\right) \cdot \left(-b\right) + \left(\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) \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}}{3 \cdot a}\]
    7. Applied associate-/r/20.5

      \[\leadsto \frac{\color{blue}{\frac{0 + 3 \cdot \left(a \cdot c\right)}{{\left(-b\right)}^{3} - {\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}^{3}} \cdot \left(\left(-b\right) \cdot \left(-b\right) + \left(\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) \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a}\]
    8. Applied times-frac20.6

      \[\leadsto \color{blue}{\frac{\frac{0 + 3 \cdot \left(a \cdot c\right)}{{\left(-b\right)}^{3} - {\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}^{3}}}{3} \cdot \frac{\left(-b\right) \cdot \left(-b\right) + \left(\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) \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{a}}\]
    9. Simplified20.6

      \[\leadsto \color{blue}{\frac{3 \cdot \left(a \cdot c\right)}{3 \cdot \left({\left(-b\right)}^{3} - {\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}^{3}\right)}} \cdot \frac{\left(-b\right) \cdot \left(-b\right) + \left(\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) \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{a}\]
    10. Simplified20.7

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

    if 7790440143226900 < b

    1. Initial program 56.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-+56.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. Simplified27.5

      \[\leadsto \frac{\frac{\color{blue}{0 + 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 associate-/r*27.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -6.2318633362822913 \cdot 10^{107}:\\ \;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le 2.93197497284158803 \cdot 10^{-107}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;b \le 7790440143226900:\\ \;\;\;\;\frac{3 \cdot \left(a \cdot c\right)}{3 \cdot \left({\left(-b\right)}^{3} - {\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}^{3}\right)} \cdot \left(\frac{{b}^{2} + \left(b \cdot b - \left(3 \cdot a\right) \cdot c\right)}{a} - \frac{b \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{3 \cdot \left(a \cdot c\right)}{3 \cdot \left(\left(-b\right) - \left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)\right)}}{a}\\ \end{array}\]

Reproduce

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