Average Error: 33.2 → 9.7
Time: 2.9m
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 -5.757200191145825 \cdot 10^{+153}:\\ \;\;\;\;\frac{-2}{a} \cdot \frac{b}{3}\\ \mathbf{if}\;b \le 3.0770720425503682 \cdot 10^{-133}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} - b}{3}}{a}\\ \mathbf{if}\;b \le 1.8263907803670084 \cdot 10^{-69}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}\\ \mathbf{if}\;b \le 4.489625985103155 \cdot 10^{-30}:\\ \;\;\;\;\frac{\frac{\left(-a\right) \cdot \left(c \cdot 3\right)}{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} + b}}{3 \cdot a}\\ \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 < -5.757200191145825e+153

    1. Initial program 60.7

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

      \[\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 *-un-lft-identity60.7

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

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

      \[\leadsto \frac{1}{3} \cdot \color{blue}{\left(-2 \cdot \frac{b}{a}\right)}\]
    7. Applied simplify2.8

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

    if -5.757200191145825e+153 < b < 3.0770720425503682e-133

    1. Initial program 10.3

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

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

    if 3.0770720425503682e-133 < b < 1.8263907803670084e-69 or 4.489625985103155e-30 < b

    1. Initial program 51.1

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

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

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

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

    if 1.8263907803670084e-69 < b < 4.489625985103155e-30

    1. Initial program 38.4

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

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

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

      \[\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}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify9.7

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -5.757200191145825 \cdot 10^{+153}:\\ \;\;\;\;\frac{-2}{a} \cdot \frac{b}{3}\\ \mathbf{if}\;b \le 3.0770720425503682 \cdot 10^{-133}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} - b}{3}}{a}\\ \mathbf{if}\;b \le 1.8263907803670084 \cdot 10^{-69}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}\\ \mathbf{if}\;b \le 4.489625985103155 \cdot 10^{-30}:\\ \;\;\;\;\frac{\frac{\left(-a\right) \cdot \left(c \cdot 3\right)}{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} + b}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}\\ \end{array}}\]

Runtime

Time bar (total: 2.9m)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)))