mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Use floor division operator.
This commit is contained in:
parent
a4c6a8522c
commit
4837a223ee
1 changed files with 3 additions and 3 deletions
|
@ -1924,7 +1924,7 @@ class Decimal(object):
|
||||||
|
|
||||||
tmp = Decimal(self)
|
tmp = Decimal(self)
|
||||||
|
|
||||||
expadd = tmp._exp / 2
|
expadd = tmp._exp // 2
|
||||||
if tmp._exp & 1:
|
if tmp._exp & 1:
|
||||||
tmp._int += (0,)
|
tmp._int += (0,)
|
||||||
tmp._exp = 0
|
tmp._exp = 0
|
||||||
|
@ -1939,12 +1939,12 @@ class Decimal(object):
|
||||||
ans = Decimal( (0, (8,1,9), tmp.adjusted() - 2) )
|
ans = Decimal( (0, (8,1,9), tmp.adjusted() - 2) )
|
||||||
ans = ans.__add__(tmp.__mul__(Decimal((0, (2,5,9), -2)),
|
ans = ans.__add__(tmp.__mul__(Decimal((0, (2,5,9), -2)),
|
||||||
context=context), context=context)
|
context=context), context=context)
|
||||||
ans._exp -= 1 + tmp.adjusted()/2
|
ans._exp -= 1 + tmp.adjusted() // 2
|
||||||
else:
|
else:
|
||||||
ans = Decimal( (0, (2,5,9), tmp._exp + len(tmp._int)- 3) )
|
ans = Decimal( (0, (2,5,9), tmp._exp + len(tmp._int)- 3) )
|
||||||
ans = ans.__add__(tmp.__mul__(Decimal((0, (8,1,9), -3)),
|
ans = ans.__add__(tmp.__mul__(Decimal((0, (8,1,9), -3)),
|
||||||
context=context), context=context)
|
context=context), context=context)
|
||||||
ans._exp -= 1 + tmp.adjusted()/2
|
ans._exp -= 1 + tmp.adjusted() // 2
|
||||||
|
|
||||||
#ans is now a linear approximation.
|
#ans is now a linear approximation.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue