def testApproximateCos1(self):
    x = F(1)
    (i, lasts, s, fact, num, sign) = (0, 0, F(1), 1, 1, 1)
    while (abs((s - lasts)) > F(1, (10 ** 9))):
        lasts = s
        i += 2
        fact *= (i * (i - 1))
        num *= (x * x)
        sign *= (- 1)
        s += ((num / fact) * sign)
    self.assertAlmostEqual(math.cos(1), s)
def testApproximateCos1(self):
    x = F(1)
    (i, lasts, s, fact, num, sign) = (0, 0, F(1), 1, 1, 1)
    while (abs((s - lasts)) > F(1, (10 ** 9))):
        lasts = s
        i += 2
        fact *= (i * (i - 1))
        num *= (x * x)
        sign *= (- 1)
        s += ((num / fact) * sign)
    self.assertAlmostEqual(math.cos(1), s)