Average Error: 31.0 → 0.5
Time: 56.6s
Precision: 64
Internal Precision: 2368
\[\frac{1 - \cos x}{x \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02734102831828874:\\ \;\;\;\;\frac{\sqrt[3]{1 - \cos x} \cdot \sqrt[3]{1 - \cos x}}{x} \cdot \frac{\sqrt[3]{1 - \cos x}}{x}\\ \mathbf{if}\;x \le 0.03142103667757586:\\ \;\;\;\;(\frac{1}{720} \cdot \left({x}^{4}\right) + \frac{1}{2})_* - \left(x \cdot x\right) \cdot \frac{1}{24}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot x} - \frac{\cos x}{x \cdot x}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if x < -0.02734102831828874

    1. Initial program 1.2

      \[\frac{1 - \cos x}{x \cdot x}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt1.6

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1 - \cos x} \cdot \sqrt[3]{1 - \cos x}\right) \cdot \sqrt[3]{1 - \cos x}}}{x \cdot x}\]
    4. Applied times-frac0.9

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1 - \cos x} \cdot \sqrt[3]{1 - \cos x}}{x} \cdot \frac{\sqrt[3]{1 - \cos x}}{x}}\]

    if -0.02734102831828874 < x < 0.03142103667757586

    1. Initial program 61.2

      \[\frac{1 - \cos x}{x \cdot x}\]
    2. Taylor expanded around 0 0.0

      \[\leadsto \color{blue}{\left(\frac{1}{720} \cdot {x}^{4} + \frac{1}{2}\right) - \frac{1}{24} \cdot {x}^{2}}\]
    3. Applied simplify0.0

      \[\leadsto \color{blue}{(\frac{1}{720} \cdot \left({x}^{4}\right) + \frac{1}{2})_* - \left(x \cdot x\right) \cdot \frac{1}{24}}\]

    if 0.03142103667757586 < x

    1. Initial program 0.9

      \[\frac{1 - \cos x}{x \cdot x}\]
    2. Using strategy rm
    3. Applied div-sub1.0

      \[\leadsto \color{blue}{\frac{1}{x \cdot x} - \frac{\cos x}{x \cdot x}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 56.6s)Debug logProfile

herbie shell --seed 2019053 +o rules:numerics
(FPCore (x)
  :name "cos2 (problem 3.4.1)"
  (/ (- 1 (cos x)) (* x x)))