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