MCPcopy Index your code
hub / github.com/python/cpython / __floor__

Method __floor__

Lib/_pydecimal.py:1846–1859  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 2

is_nanMethod · 0.95
_rescaleMethod · 0.95

Tested by

no test coverage detected