Average Error: 33.2 → 10.1
Time: 2.5m
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}\;-\frac{\frac{3}{2}}{b} \le -7.888718618379168 \cdot 10^{+134}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{3}}{a}\\ \mathbf{if}\;-\frac{\frac{3}{2}}{b} \le -8.212919251041001 \cdot 10^{+68}:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \mathbf{if}\;-\frac{\frac{3}{2}}{b} \le -1.6815999881245 \cdot 10^{+30}:\\ \;\;\;\;\frac{\frac{\left(3 \cdot c\right) \cdot \left(-a\right)}{b + \sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)}}}{3 \cdot a}\\ \mathbf{if}\;-\frac{\frac{3}{2}}{b} \le 1.8580503660179837 \cdot 10^{-299}:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \mathbf{if}\;-\frac{\frac{3}{2}}{b} \le 3.953570479786439 \cdot 10^{-151}:\\ \;\;\;\;\frac{b}{a} \cdot \frac{-2}{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{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 (/ (- 3/2) b) < -7.888718618379168e+134 or 3.953570479786439e-151 < (/ (- 3/2) b)

    1. Initial program 10.2

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied associate-/r*10.2

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

    if -7.888718618379168e+134 < (/ (- 3/2) b) < -8.212919251041001e+68 or -1.6815999881245e+30 < (/ (- 3/2) b) < 1.8580503660179837e-299

    1. Initial program 51.0

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify51.0

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

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

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

    if -8.212919251041001e+68 < (/ (- 3/2) b) < -1.6815999881245e+30

    1. Initial program 38.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify38.8

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied flip--38.9

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

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

    if 1.8580503660179837e-299 < (/ (- 3/2) b) < 3.953570479786439e-151

    1. Initial program 59.8

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Applied simplify59.8

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;-\frac{\frac{3}{2}}{b} \le -7.888718618379168 \cdot 10^{+134}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{3}}{a}\\ \mathbf{if}\;-\frac{\frac{3}{2}}{b} \le -8.212919251041001 \cdot 10^{+68}:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \mathbf{if}\;-\frac{\frac{3}{2}}{b} \le -1.6815999881245 \cdot 10^{+30}:\\ \;\;\;\;\frac{\frac{\left(3 \cdot c\right) \cdot \left(-a\right)}{b + \sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)}}}{3 \cdot a}\\ \mathbf{if}\;-\frac{\frac{3}{2}}{b} \le 1.8580503660179837 \cdot 10^{-299}:\\ \;\;\;\;\frac{\frac{-3}{2}}{3} \cdot \frac{c}{b}\\ \mathbf{if}\;-\frac{\frac{3}{2}}{b} \le 3.953570479786439 \cdot 10^{-151}:\\ \;\;\;\;\frac{b}{a} \cdot \frac{-2}{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{3}}{a}\\ \end{array}}\]

Runtime

Time bar (total: 2.5m)Debug logProfile

herbie shell --seed '#(1070578969 3140398606 632207097 462683394 1189254563 964980650)' 
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))