Average Error: 44.0 → 42.2
Time: 27.8s
Precision: 64
Internal Precision: 2624
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \le -3.146842250165989 \cdot 10^{-21}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\left(b + b\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 2 regimes
  2. if (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)) < -3.146842250165989e-21

    1. Initial program 24.2

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

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

    if -3.146842250165989e-21 < (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a))

    1. Initial program 61.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-cube-cbrt61.9

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\left(\sqrt[3]{\left(3 \cdot a\right) \cdot c} \cdot \sqrt[3]{\left(3 \cdot a\right) \cdot c}\right) \cdot \sqrt[3]{\left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied add-log-exp62.1

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\log \left(e^{\sqrt[3]{\left(3 \cdot a\right) \cdot c} \cdot \sqrt[3]{\left(3 \cdot a\right) \cdot c}}\right)} \cdot \sqrt[3]{\left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    6. Taylor expanded around -inf 58.5

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

      \[\leadsto \color{blue}{\frac{-\left(b + b\right)}{a \cdot 3}}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 27.8s)Debug logProfile

herbie shell --seed '#(1071821486 549052472 3784827256 1559736200 3548510075 881134285)' 
(FPCore (a b c d)
  :name "Cubic critical, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))