MCPcopy Index your code
hub / github.com/RustPython/RustPython / __floor__

Method __floor__

Lib/_pydecimal.py:1843–1856  ·  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

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.

Callers

nothing calls this directly

Calls 2

is_nanMethod · 0.95
_rescaleMethod · 0.95

Tested by

no test coverage detected