Bugs item #1388949, was opened at 2005-12-23 12:11 Message generated for change (Comment added) made by facundobatista You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1388949&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None >Status: Closed >Resolution: Rejected Priority: 5 Submitted By: Adam Olsen (rhamphoryncus) Assigned to: Facundo Batista (facundobatista) Summary: Decimal sqrt() ignores rounding Initial Comment: Decimal Contexts' sqrt() method exhibits the same rounding behavior irregardless of the rounding parameter. >>> c = decimal.Context(rounding=decimal.ROUND_CEILING) >>> f = decimal.Context(rounding=decimal.ROUND_FLOOR) >>> cs = decimal.Context(rounding=decimal.ROUND_CEILING, prec=14) >>> fs = decimal.Context(rounding=decimal.ROUND_FLOOR, prec=14) >>> c.sqrt(D(2)) Decimal("1.414213562373095048801688724") >>> f.sqrt(D(2)) Decimal("1.414213562373095048801688724") >>> cs.sqrt(D(2)) Decimal("1.4142135623731") >>> fs.sqrt(D(2)) Decimal("1.4142135623731") It appears to always round up. Python 2.4.2 (#2, Nov 20 2005, 17:04:48) Debian unstable ---------------------------------------------------------------------- >Comment By: Facundo Batista (facundobatista) Date: 2005-12-24 14:46 Message: Logged In: YES user_id=752496 The rounding setting in the context is not used, always uses the round-half-even algorithm, as specified in the Decimal Specification (see http://www2.hursley.ibm.com/decimal/daops.html#refsqrt). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1388949&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com