Average Error: 34.1 → 7.0
Time: 2.1m
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}\;\frac{-\frac{3}{2}}{b} \le -3.330226014690885 \cdot 10^{-67}:\\ \;\;\;\;\frac{-c}{\sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}\\ \mathbf{if}\;\frac{-\frac{3}{2}}{b} \le -7.036172839470016 \cdot 10^{-307}:\\ \;\;\;\;\frac{-c}{b + b}\\ \mathbf{if}\;\frac{-\frac{3}{2}}{b} \le 4.002029844616973 \cdot 10^{-107}:\\ \;\;\;\;\frac{\frac{\frac{3}{2} \cdot a}{\frac{b}{c}} - \left(b + b\right)}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}{a \cdot 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 (/ (- 3/2) b) < -3.330226014690885e-67

    1. Initial program 30.5

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\left(c \cdot a\right) \cdot \left(-3\right)}}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}{3 \cdot a}\]
    6. Using strategy rm
    7. Applied distribute-rgt-neg-out17.8

      \[\leadsto \frac{\frac{\color{blue}{-\left(c \cdot a\right) \cdot 3}}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}{3 \cdot a}\]
    8. Applied distribute-frac-neg17.8

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

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

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

    if -3.330226014690885e-67 < (/ (- 3/2) b) < -7.036172839470016e-307

    1. Initial program 57.5

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\left(c \cdot a\right) \cdot \left(-3\right)}}{\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}}{3 \cdot a}\]
    6. Taylor expanded around 0 14.9

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

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

    if -7.036172839470016e-307 < (/ (- 3/2) b) < 4.002029844616973e-107

    1. Initial program 47.9

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

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

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

    if 4.002029844616973e-107 < (/ (- 3/2) b)

    1. Initial program 9.0

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify7.0

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\frac{-\frac{3}{2}}{b} \le -3.330226014690885 \cdot 10^{-67}:\\ \;\;\;\;\frac{-c}{\sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b}\\ \mathbf{if}\;\frac{-\frac{3}{2}}{b} \le -7.036172839470016 \cdot 10^{-307}:\\ \;\;\;\;\frac{-c}{b + b}\\ \mathbf{if}\;\frac{-\frac{3}{2}}{b} \le 4.002029844616973 \cdot 10^{-107}:\\ \;\;\;\;\frac{\frac{\frac{3}{2} \cdot a}{\frac{b}{c}} - \left(b + b\right)}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}{a \cdot 3}\\ \end{array}}\]

Runtime

Time bar (total: 2.1m)Debug logProfile

herbie shell --seed 2018206 +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))