Average Error: 31.6 → 0.4
Time: 20.8s
Precision: 64
Internal Precision: 2432
\[\frac{1 - \cos x}{x \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.03583350383358707:\\ \;\;\;\;\frac{1}{x \cdot x} - \frac{\cos x}{x \cdot x}\\ \mathbf{if}\;x \le 0.03009247951436836:\\ \;\;\;\;\left(\frac{1}{2} + \frac{1}{720} \cdot {x}^{4}\right) - \frac{1}{24} \cdot {x}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{1 - \cos x}{x}\\ \end{array}\]

Error

Bits error versus x

Derivation

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

    1. Initial program 1.0

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

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

    if -0.03583350383358707 < x < 0.03009247951436836

    1. Initial program 61.3

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

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

    if 0.03009247951436836 < x

    1. Initial program 1.0

      \[\frac{1 - \cos x}{x \cdot x}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity1.0

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

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

Runtime

Time bar (total: 20.8s)Debug logProfile

herbie shell --seed '#(1070227846 1561819246 480764335 4016816270 2602869839 2117310382)' 
(FPCore (x)
  :name "cos2 (problem 3.4.1)"
  (/ (- 1 (cos x)) (* x x)))