Average Error: 33.6 → 8.4
Time: 3.0m
Precision: 64
Internal Precision: 3456
\[\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.1846882994653866 \cdot 10^{+58}:\\ \;\;\;\;\frac{\frac{c}{b}}{2} - \frac{b + b}{3 \cdot a}\\ \mathbf{if}\;b \le -3.5378226834836973 \cdot 10^{-300}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{if}\;b \le 5.899961293553445 \cdot 10^{+34}:\\ \;\;\;\;\frac{\frac{c}{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{a \cdot 3}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\left(-b\right) - b\right) - \frac{\frac{-3}{2} \cdot a}{\frac{b}{c}}}\\ \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 < -3.1846882994653866e+58

    1. Initial program 37.0

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

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

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

    if -3.1846882994653866e+58 < b < -3.5378226834836973e-300

    1. Initial program 10.0

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

    if -3.5378226834836973e-300 < b < 5.899961293553445e+34

    1. Initial program 28.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-+28.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. Applied simplify17.2

      \[\leadsto \frac{\frac{\color{blue}{c \cdot \left(a \cdot 3\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-/l*14.3

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

    if 5.899961293553445e+34 < b

    1. Initial program 56.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-+56.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. Applied simplify26.9

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

      \[\leadsto \frac{\frac{c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \color{blue}{\left(b - \frac{3}{2} \cdot \frac{c \cdot a}{b}\right)}}}{3 \cdot a}\]
    6. Applied simplify4.5

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

Runtime

Time bar (total: 3.0m)Debug logProfile

herbie shell --seed '#(1070991898 1055468627 4280279443 640792587 928206309 3646738750)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))