Average Error: 33.4 → 9.4
Time: 1.6m
Precision: 64
Internal Precision: 3200
\[\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 -9.929910345568095 \cdot 10^{+126}:\\ \;\;\;\;\frac{\frac{c}{\frac{b}{\frac{3}{2}}} - \left(\frac{b}{a} + \frac{b}{a}\right)}{3}\\ \mathbf{if}\;b \le 3.856654635400748 \cdot 10^{-124}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}\\ \mathbf{if}\;b \le 5.123302111325355 \cdot 10^{+130}:\\ \;\;\;\;\frac{\frac{c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{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 < -9.929910345568095e+126

    1. Initial program 52.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 *-un-lft-identity52.1

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

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

      \[\leadsto \frac{1}{3} \cdot \frac{\color{blue}{\frac{3}{2} \cdot \frac{c \cdot a}{b} - 2 \cdot b}}{a}\]
    6. Applied simplify3.0

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

    if -9.929910345568095e+126 < b < 3.856654635400748e-124

    1. Initial program 11.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*11.5

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

    if 3.856654635400748e-124 < b < 5.123302111325355e+130

    1. Initial program 40.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-+40.8

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

      \[\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 5.123302111325355e+130 < b

    1. Initial program 60.7

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

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

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

Runtime

Time bar (total: 1.6m)Debug logProfile

herbie shell --seed '#(1070100504 930361288 1279167582 284574201 1450237281 2578255382)' +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))