Average Error: 33.7 → 7.7
Time: 46.3s
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}\;b \le -1.5409374031019006 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{3}{2} \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{if}\;b \le -3.669436441972135 \cdot 10^{-307}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + \left(-b\right)}{3 \cdot a}\\ \mathbf{if}\;b \le 2.806125992676969 \cdot 10^{+107}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \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 < -1.5409374031019006e+154

    1. Initial program 61.0

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

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

    if -1.5409374031019006e+154 < b < -3.669436441972135e-307

    1. Initial program 9.1

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

    if -3.669436441972135e-307 < b < 2.806125992676969e+107

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

      \[\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 0 16.8

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

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

    if 2.806125992676969e+107 < b

    1. Initial program 58.9

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

      \[\leadsto \frac{\color{blue}{\frac{-3}{2} \cdot \frac{c \cdot a}{b}}}{3 \cdot a}\]
    3. Applied simplify2.0

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -1.5409374031019006 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{3}{2} \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{if}\;b \le -3.669436441972135 \cdot 10^{-307}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + \left(-b\right)}{3 \cdot a}\\ \mathbf{if}\;b \le 2.806125992676969 \cdot 10^{+107}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \end{array}}\]

Runtime

Time bar (total: 46.3s)Debug logProfile

herbie shell --seed '#(1071725047 233389029 2036512464 3988615230 2972226563 1111574017)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))