On Saturday, March 8, 2014 12:49:02 PM UTC-6, Mark Dickinson wrote:
 
- if we're aiming to eliminate surprises, the 'fix' doesn't go far enough: Decimal(1.1 + 2.2) will still surprise, as will {snip}

On the other hand, how is this now possible?

>>> ====== RESTART ==========================
>>> from pdeclib import *
>>> d(1.1+2.2)
Decimal('3.3')
>>> sqrt(1.1+2.2)
Decimal('1.81659021245849499925351968583091621951684')
>>> sqrt(1.1+2.2)**2
Decimal('3.29999999999999999999999999999999999999999')
>>> 

def sqrt(x):
    """ sqrt(x)     square root function

             (x may be string, int, float, or decimal)
             (returns decimal rounded to context precision)
    """
    y=x.__round__(15)
    with localcontext(ctx=None) as cmngr:
        cmngr.prec+=14
        sqr=Decimal(repr(y)).sqrt()
    return +sqr

What say you?