Average Error: 33.3 → 10.7
Time: 2.6m
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 -3.123241452794984 \cdot 10^{+45}:\\ \;\;\;\;\frac{\left(c \cdot \frac{3}{2}\right) \cdot \frac{a}{b} - \left(b + b\right)}{a \cdot 3}\\ \mathbf{if}\;b \le 1.0881211606334829 \cdot 10^{-108}:\\ \;\;\;\;\frac{\sqrt{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}{\frac{a \cdot 3}{\sqrt{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}}}\\ \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 3 regimes
  2. if b < -3.123241452794984e+45

    1. Initial program 36.0

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

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

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

    if -3.123241452794984e+45 < b < 1.0881211606334829e-108

    1. Initial program 12.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 add-sqr-sqrt13.1

      \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    4. Applied associate-/l*13.1

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

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

    if 1.0881211606334829e-108 < b

    1. Initial program 50.7

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

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -3.123241452794984 \cdot 10^{+45}:\\ \;\;\;\;\frac{\left(c \cdot \frac{3}{2}\right) \cdot \frac{a}{b} - \left(b + b\right)}{a \cdot 3}\\ \mathbf{if}\;b \le 1.0881211606334829 \cdot 10^{-108}:\\ \;\;\;\;\frac{\sqrt{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}{\frac{a \cdot 3}{\sqrt{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \end{array}}\]

Runtime

Time bar (total: 2.6m)Debug logProfile

herbie shell --seed '#(1071501266 3581234924 1086666455 2685055582 1243441566 1802958749)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))