Average Error: 33.7 → 10.0
Time: 1.7m
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 -8.292711909480242 \cdot 10^{+126}:\\ \;\;\;\;\frac{\frac{3}{2} \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{if}\;b \le 9.244119714144306 \cdot 10^{-267}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{if}\;b \le 2.225507581463094 \cdot 10^{+103}:\\ \;\;\;\;\frac{\frac{c \cdot \left(3 \cdot a\right)}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{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 < -8.292711909480242e+126

    1. Initial program 51.7

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

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

    if -8.292711909480242e+126 < b < 9.244119714144306e-267

    1. Initial program 9.5

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied associate-/r*9.5

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

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

    if 9.244119714144306e-267 < b < 2.225507581463094e+103

    1. Initial program 33.8

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

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

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

    if 2.225507581463094e+103 < b

    1. Initial program 59.4

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

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

      \[\leadsto \color{blue}{1 \cdot \left(\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}\right)}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify10.0

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \le -8.292711909480242 \cdot 10^{+126}:\\ \;\;\;\;\frac{\frac{3}{2} \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{if}\;b \le 9.244119714144306 \cdot 10^{-267}:\\ \;\;\;\;\frac{\frac{\sqrt{(\left(-c\right) \cdot \left(3 \cdot a\right) + \left(b \cdot b\right))_*} - b}{3}}{a}\\ \mathbf{if}\;b \le 2.225507581463094 \cdot 10^{+103}:\\ \;\;\;\;\frac{\frac{c \cdot \left(3 \cdot a\right)}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{\frac{-3}{2}}{3}\\ \end{array}}\]

Runtime

Time bar (total: 1.7m)Debug logProfile

herbie shell --seed '#(1071948828 1180510430 2986424009 997076509 406109801 420189285)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))