Can anyone offer a suggestion?
Grant Edwards
grante at visi.com
Thu Jul 12 13:50:39 EDT 2001
In article <9ikgpq$j1cff$1 at ID-11957.news.dfncis.de>, Emile van Sebille wrote:
>I've been writing a business math class that allows for multiple precision
>accuracy, and in testing stumbled on this behavior:
>
>>>> from BNum import BNum as bn
>
>>>> ab = bn('1.2340000')
>>>> cb = bn('123.45')
>>>> ab
>1.2340000
>>>> ab * cb
>152.3373000
>>>> (ab*cb).disp(2)
>'152.34'
>>>> print '%8.2f' % ab*cb
>151.84
Eh?? Shouldn't give an error:
'%8.2f' % ab*cb ==> ('%8.2f' % ab) * cb
==> 'some string' * cb
if cb is a float, you should get an error like this:
>>> print "%8.2f" % 3.4*5.5
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: unsupported operand type(s) for *
>>>
--
Grant Edwards grante Yow! ... If I had heart
at failure right now,
visi.com I couldn't be a more
fortunate man!!
More information about the Python-list
mailing list