From b87889974b9a600624e10ab4c46adfd2c1f930ff Mon Sep 17 00:00:00 2001 From: tserg <8017125+tserg@users.noreply.github.com> Date: Sat, 5 Aug 2023 23:47:12 +0800 Subject: [PATCH] docs: epsilon builtin (#3552) --- docs/built-in-functions.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/built-in-functions.rst b/docs/built-in-functions.rst index 74e8560498..84859d66c2 100644 --- a/docs/built-in-functions.rst +++ b/docs/built-in-functions.rst @@ -573,6 +573,24 @@ Math >>> ExampleContract.foo(3.1337) 4 +.. py:function:: epsilon(typename) -> Any + + Returns the smallest non-zero value for a decimal type. + + * ``typename``: Name of the decimal type (currently only ``decimal``) + + .. code-block:: python + + @external + @view + def foo() -> decimal: + return epsilon(decimal) + + .. code-block:: python + + >>> ExampleContract.foo() + Decimal('1E-10') + .. py:function:: floor(value: decimal) -> int256 Round a decimal down to the nearest integer.