Return the floor of self, as an integer. For a finite Decimal instance self, return the greatest integer n such that n <= self. If self is infinite or a NaN then a Python exception is raised.
(self)
| 1841 | return int(self._rescale(0, ROUND_HALF_EVEN)) |
| 1842 | |
| 1843 | def __floor__(self): |
| 1844 | """Return the floor of self, as an integer. |
| 1845 | |
| 1846 | For a finite Decimal instance self, return the greatest |
| 1847 | integer n such that n <= self. If self is infinite or a NaN |
| 1848 | then a Python exception is raised. |
| 1849 | |
| 1850 | """ |
| 1851 | if self._is_special: |
| 1852 | if self.is_nan(): |
| 1853 | raise ValueError("cannot round a NaN") |
| 1854 | else: |
| 1855 | raise OverflowError("cannot round an infinity") |
| 1856 | return int(self._rescale(0, ROUND_FLOOR)) |
| 1857 | |
| 1858 | def __ceil__(self): |
| 1859 | """Return the ceiling of self, as an integer. |