Average Error: 33.3 → 7.1
Time: 2.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 -6.250929849623932 \cdot 10^{+127}:\\ \;\;\;\;\frac{-2}{3} \cdot \frac{b}{a}\\ \mathbf{if}\;b \le 1.074280805301301 \cdot 10^{-207}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}\\ \mathbf{if}\;b \le 1.9222062848851805 \cdot 10^{+61}:\\ \;\;\;\;\left(\sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}} \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}}\right) \cdot \sqrt[3]{\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}\\ \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 < -6.250929849623932e+127

    1. Initial program 51.3

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

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

    if -6.250929849623932e+127 < b < 1.074280805301301e-207

    1. Initial program 9.6

      \[\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*9.6

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

    if 1.074280805301301e-207 < b < 1.9222062848851805e+61

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

      \[\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.5

      \[\leadsto \frac{\frac{\color{blue}{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 add-cube-cbrt18.1

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

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

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

    if 1.9222062848851805e+61 < b

    1. Initial program 56.8

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

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

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

Runtime

Time bar (total: 2.0m)Debug logProfile

herbie shell --seed '#(1064173506 2580572819 2847706409 4129882574 1125180799 1845288547)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))