Average Error: 33.8 → 9.7
Time: 1.7m
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 \cdot \frac{-2}{3} \le -683021090975165.6:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \mathbf{if}\;b \cdot \frac{-2}{3} \le -1.2854843954002561 \cdot 10^{-65}:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \mathbf{if}\;b \cdot \frac{-2}{3} \le 4.795582047952268 \cdot 10^{+117}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{b \cdot \frac{-2}{3}}{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 (* -2/3 b) < -683021090975165.6

    1. Initial program 55.3

      \[\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 simplify5.1

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

    if -683021090975165.6 < (* -2/3 b) < -1.2854843954002561e-65

    1. Initial program 43.5

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

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

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

    if -1.2854843954002561e-65 < (* -2/3 b) < 4.795582047952268e+117

    1. Initial program 12.8

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

    if 4.795582047952268e+117 < (* -2/3 b)

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

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

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \cdot \frac{-2}{3} \le -683021090975165.6:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \mathbf{if}\;b \cdot \frac{-2}{3} \le -1.2854843954002561 \cdot 10^{-65}:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \mathbf{if}\;b \cdot \frac{-2}{3} \le 4.795582047952268 \cdot 10^{+117}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{b \cdot \frac{-2}{3}}{a}\\ \end{array}}\]

Runtime

Time bar (total: 1.7m)Debug logProfile

herbie shell --seed '#(1070386091 2509006183 1430610344 1025408621 36622005 1425925650)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))