MCPcopy Create free account
hub / github.com/eshirazi/python-with-braces / create_decimal_from_float

Method create_decimal_from_float

Lib/decimal.py:3939–3954  ·  view source on GitHub ↗

Creates a new Decimal instance from a float but rounding using self as the context. >>> context = Context(prec=5, rounding=ROUND_DOWN) >>> context.create_decimal_from_float(3.1415926535897932) Decimal('3.1415') >>> context = Context(prec=5, traps=[Inexact])

(self, f)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls 2

from_floatMethod · 0.45
_fixMethod · 0.45

Tested by

no test coverage detected