Q:

Excel calculation vs. python, and decimal usage

Sorry, a few parts to this question. I need to run calculations with very accurate precision.
I am playing around with Decimal in python and trying to verify the calculations. I believe to use the actual number, you need to have the number as a string right? I am running the below code.
1) For A I have it as a float, and B I have it as a string. I get different numbers when I square them, is that because of floating point arithmetic? Is B ** 2 more correct?   
2) On the last print statement, I am trying to get the square root, but end up with a TypeError: unsupported operand type(s) for ** or pow(): 'Decimal' and 'float'. Why is that?   
3) Lastly when I try to verify 100.0897463 squared in excel, I get an answer of 10017.95731439840000000000. Is the difference just due to rounding? What is an effective way of verifying floating point vs. decimal calculations if not through something like excel?
A = decimal.Decimal(100.0897463)
B = decimal.Decimal('100.0897463')
print A ** 2
print B ** 2
print B ** .5

Gets me these to numbers, 
10017.95731439836401246854725
10017.95731439836369

Interestingly, when I run the code like this, I get the exact same numbers for both, and they not either of the results from printing without the decimal precision. Why would that be?
print "%.20f" % A ** 2
print "%.20f" % B ** 2

Results in:
10017.95731439836345089134
10017.95731439836345089134

A:

1) For A I have it as a float, and B I have it as a string. I get different numbers when I square them, is that because of floating point arithmetic? Is B ** 2 more correct? 

B ** 2 is more correct.  A is imprecise because you are initializing the Decimal from a float and not a string.  

2) On the last print statement, I am trying to get the square root, but end up with a TypeError: unsupported operand type(s) for ** or pow(): 'Decimal' and 'float'. Why is that? 

Because Decimal’s implementation of __pow__ expects the parameter to be of the same type.  i.e., also a Decimal
    B ** decimal.Decimal('0.5') 
    # this works because B and the exponent are now of the same type

3) Lastly when I try to verify 100.0897463 squared in excel, I get an answer of 10017.95731439840000000000. Is the difference just due to rounding? What is an effective way of verifying floating point vs. decimal calculations if not through something like excel

Doing the math by hand.  In this case, you can see that the last digit of the number you are squaring is 3 which means that its square should end in a 9.  This strongly implies that excel also has rounding/precision issues (expected).  

Your other question

It looks like %f is converting the Decimal to a float before printing.  In order to alleviate this, print with %s:
print '%s' % (A ** 2,)
print '%s' % (B ** 2,)

To see the difference.

