Average Error: 33.8 → 13.1
Time: 1.5m
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}\;b \le -3.242988518190772 \cdot 10^{-273}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 3}{\sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}\\ \mathbf{elif}\;b \le 1.1277322806926039 \cdot 10^{+103}:\\ \;\;\;\;\frac{-c}{b + \sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b + b}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Split input into 3 regimes
  2. if b < -3.242988518190772e-273

    1. Initial program 21.9

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

      \[\leadsto \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 clear-num21.9

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

    if -3.242988518190772e-273 < b < 1.1277322806926039e+103

    1. Initial program 31.7

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

      \[\leadsto \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--31.9

      \[\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 associate-/l/36.2

      \[\leadsto \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}{\left(3 \cdot a\right) \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b\right)}}\]
    6. Simplified20.4

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

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

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

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

    if 1.1277322806926039e+103 < b

    1. Initial program 59.2

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

      \[\leadsto \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--59.3

      \[\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 associate-/l/59.4

      \[\leadsto \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}{\left(3 \cdot a\right) \cdot \left(\sqrt{(\left(3 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} + b\right)}}\]
    6. Simplified32.6

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

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

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

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

      \[\leadsto -\frac{\frac{c}{1}}{\color{blue}{b} + b}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification13.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -3.242988518190772 \cdot 10^{-273}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 3}{\sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}}\\ \mathbf{elif}\;b \le 1.1277322806926039 \cdot 10^{+103}:\\ \;\;\;\;\frac{-c}{b + \sqrt{(\left(a \cdot 3\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b + b}\\ \end{array}\]

Runtime

Time bar (total: 1.5m)Debug logProfile

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