Average Error: 33.6 → 6.7
Time: 2.9m
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}\;\left(-b\right) - b \le -4.14115726340382 \cdot 10^{+150}:\\ \;\;\;\;\frac{c}{\left(-b\right) - b}\\ \mathbf{elif}\;\left(-b\right) - b \le -1.7772766910390334 \cdot 10^{-303}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{(\left(3 \cdot c\right) \cdot \left(-a\right) + \left(b \cdot b\right))_*}}\\ \mathbf{elif}\;\left(-b\right) - b \le 4.313970378554904 \cdot 10^{+125}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{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) b) < -4.14115726340382e+150

    1. Initial program 62.5

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

      \[\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 associate-/l/62.5

      \[\leadsto \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(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
    5. Simplified36.4

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

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

      \[\leadsto \frac{\frac{3 \cdot \left(c \cdot a\right)}{3 \cdot a}}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
    10. Applied *-un-lft-identity36.2

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

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

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

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

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

    if -4.14115726340382e+150 < (- (- b) b) < -1.7772766910390334e-303

    1. Initial program 34.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 flip-+34.9

      \[\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 associate-/l/39.1

      \[\leadsto \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(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
    5. Simplified20.9

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

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

      \[\leadsto \frac{\frac{3 \cdot \left(c \cdot a\right)}{3 \cdot a}}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
    10. Applied *-un-lft-identity15.2

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

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

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

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

    if -1.7772766910390334e-303 < (- (- b) b) < 4.313970378554904e+125

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

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

    if 4.313970378554904e+125 < (- (- b) b)

    1. Initial program 51.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(-b\right) - b \le -4.14115726340382 \cdot 10^{+150}:\\ \;\;\;\;\frac{c}{\left(-b\right) - b}\\ \mathbf{elif}\;\left(-b\right) - b \le -1.7772766910390334 \cdot 10^{-303}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{(\left(3 \cdot c\right) \cdot \left(-a\right) + \left(b \cdot b\right))_*}}\\ \mathbf{elif}\;\left(-b\right) - b \le 4.313970378554904 \cdot 10^{+125}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \end{array}\]

Runtime

Time bar (total: 2.9m)Debug logProfile

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