Average Error: 33.6 → 15.4
Time: 45.8s
Precision: 64
Internal Precision: 128
\[\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 -4.1461169085460416 \cdot 10^{+127}:\\ \;\;\;\;\frac{(-2 \cdot b + \left(\left(a \cdot c\right) \cdot \frac{\frac{3}{2}}{b}\right))_*}{3 \cdot a}\\ \mathbf{elif}\;b \le 6.94874581049732 \cdot 10^{-80}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot c}{b} \cdot \frac{-3}{2}}{3 \cdot 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 3 regimes
  2. if b < -4.1461169085460416e+127

    1. Initial program 51.9

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt51.9

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

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

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

    if -4.1461169085460416e+127 < b < 6.94874581049732e-80

    1. Initial program 12.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt12.3

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

    if 6.94874581049732e-80 < b

    1. Initial program 52.2

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt53.9

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

      \[\leadsto \frac{\color{blue}{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification15.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -4.1461169085460416 \cdot 10^{+127}:\\ \;\;\;\;\frac{(-2 \cdot b + \left(\left(a \cdot c\right) \cdot \frac{\frac{3}{2}}{b}\right))_*}{3 \cdot a}\\ \mathbf{elif}\;b \le 6.94874581049732 \cdot 10^{-80}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot c}{b} \cdot \frac{-3}{2}}{3 \cdot a}\\ \end{array}\]

Runtime

Time bar (total: 45.8s)Debug logProfile

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