(self)
| 1156 | self.assertEqual(hash(F(-1)), F(-1).__hash__()) |
| 1157 | |
| 1158 | def testApproximatePi(self): |
| 1159 | # Algorithm borrowed from |
| 1160 | # http://docs.python.org/lib/decimal-recipes.html |
| 1161 | three = F(3) |
| 1162 | lasts, t, s, n, na, d, da = 0, three, 3, 1, 0, 0, 24 |
| 1163 | while abs(s - lasts) > F(1, 10**9): |
| 1164 | lasts = s |
| 1165 | n, na = n+na, na+8 |
| 1166 | d, da = d+da, da+32 |
| 1167 | t = (t * n) / d |
| 1168 | s += t |
| 1169 | self.assertAlmostEqual(math.pi, s) |
| 1170 | |
| 1171 | def testApproximateCos1(self): |
| 1172 | # Algorithm borrowed from |
nothing calls this directly
no test coverage detected