Average Error: 31.5 → 0.4
Time: 20.0s
Precision: 64
Internal precision: 2432
\[\frac{1 - \cos x}{x \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -6.667433711053936 \cdot 10^{-08}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{e^{\log \left(1 - \cos x\right)}}{x}\\ \mathbf{if}\;x \le 1183236732512159.2:\\ \;\;\;\;\left(\frac{1}{2} + \frac{1}{720} \cdot {x}^{4}\right) - \frac{1}{24} \cdot {x}^2\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{e^{\log \left(1 - \cos x\right)}}{x}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes.
  2. if x < -6.667433711053936e-08 or 1183236732512159.2 < x

    1. Initial program 1.3

      \[\frac{1 - \cos x}{x \cdot x}\]
    2. Applied simplify 1.3

      \[\leadsto \color{blue}{\frac{1 - \cos x}{{x}^2}}\]
    3. Using strategy rm
    4. Applied square-mult 1.3

      \[\leadsto \frac{1 - \cos x}{\color{blue}{x \cdot x}}\]
    5. Applied *-un-lft-identity 1.3

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{1 - \cos x}{x}}\]
    7. Using strategy rm
    8. Applied add-exp-log 0.7

      \[\leadsto \frac{1}{x} \cdot \frac{\color{blue}{e^{\log \left(1 - \cos x\right)}}}{x}\]

    if -6.667433711053936e-08 < x < 1183236732512159.2

    1. Initial program 61.5

      \[\frac{1 - \cos x}{x \cdot x}\]
    2. Applied simplify 61.5

      \[\leadsto \color{blue}{\frac{1 - \cos x}{{x}^2}}\]
    3. Applied taylor 0.0

      \[\leadsto \left(\frac{1}{2} + \frac{1}{720} \cdot {x}^{4}\right) - \frac{1}{24} \cdot {x}^2\]
    4. 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}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 20.0s) Debug log

Please include this information when filing a bug report:

herbie shell --seed '#(3052192724 3812927732 3686175817 630908657 2373248591 511094450)'
(FPCore (x)
  :name "NMSE problem 3.4.1"
  :pre (!= x 0)
  (/ (- 1 (cos x)) (* x x)))