/usr/lib64/python2.6
NameSizeModeActions
bsddb/-0755rm
compiler/-0755rm
config/-0755rm
ctypes/-0755rm
curses/-0755rm
Demo/-0755rm
distutils/-0755rm
Doc/-0755rm
email/-0755rm
encodings/-0755rm
hotshot/-0755rm
idlelib/-0755rm
json/-0755rm
lib-dynload/-0755rm
lib-tk/-0755rm
lib2to3/-0755rm
logging/-0755rm
multiprocessing/-0755rm
plat-linux2/-0755rm
site-packages/-0755rm
sqlite3/-0755rm
test/-0755rm
Tools/-0755rm
wsgiref/-0755rm
xml/-0755rm
abc.py70340644editdlrm
abc.pyc60710644editdlrm
abc.pyo60130644editdlrm
aifc.py331880644editdlrm
aifc.pyc295640644editdlrm
aifc.pyo295640644editdlrm
anydbm.py26200644editdlrm
anydbm.pyc27750644editdlrm
anydbm.pyo27750644editdlrm
ast.py113470644editdlrm
ast.pyc127800644editdlrm
ast.pyo127800644editdlrm
asynchat.py114020644editdlrm
asynchat.pyc87370644editdlrm
asynchat.pyo87370644editdlrm
asyncore.py200610644editdlrm
asyncore.pyc184520644editdlrm
asyncore.pyo184520644editdlrm
atexit.py17050644editdlrm
atexit.pyc22150644editdlrm
atexit.pyo22150644editdlrm
audiodev.py75970644editdlrm
audiodev.pyc85370644editdlrm
audiodev.pyo85370644editdlrm
base64.py113350755editdlrm
base64.pyc110030644editdlrm
base64.pyo110030644editdlrm
BaseHTTPServer.py219740644editdlrm
BaseHTTPServer.pyc215750644editdlrm
BaseHTTPServer.pyo215750644editdlrm
Bastion.py57440644editdlrm
Bastion.pyc66670644editdlrm
Bastion.pyo66670644editdlrm
bdb.py205970644editdlrm
bdb.pyc185670644editdlrm
bdb.pyo185670644editdlrm
binhex.py148780644editdlrm
binhex.pyc158750644editdlrm
binhex.pyo158750644editdlrm
bisect.py26620644editdlrm
bisect.pyc31730644editdlrm
bisect.pyo31730644editdlrm
calendar.py231100644editdlrm
calendar.pyc281650644editdlrm
calendar.pyo281650644editdlrm
cgi.py344780755editdlrm
cgi.pyc328180644editdlrm
cgi.pyo328180644editdlrm
CGIHTTPServer.py127730644editdlrm
CGIHTTPServer.pyc108200644editdlrm
CGIHTTPServer.pyo108200644editdlrm
cgitb.py121550644editdlrm
cgitb.pyc124610644editdlrm
cgitb.pyo124610644editdlrm
chunk.py53720644editdlrm
chunk.pyc56450644editdlrm
chunk.pyo56450644editdlrm
cmd.py149620644editdlrm
cmd.pyc139540644editdlrm
cmd.pyo139540644editdlrm
code.py102170644editdlrm
code.pyc104270644editdlrm
code.pyo104270644editdlrm
codecs.py352660644editdlrm
codecs.pyc367210644editdlrm
codecs.pyo367210644editdlrm
codeop.py59990644editdlrm
codeop.pyc66360644editdlrm
codeop.pyo66360644editdlrm
collections.py137300644editdlrm
collections.pyc144620644editdlrm
collections.pyo144090644editdlrm
colorsys.py34590644editdlrm
colorsys.pyc40410644editdlrm
colorsys.pyo40410644editdlrm
commands.py25430644editdlrm
commands.pyc24890644editdlrm
commands.pyo24890644editdlrm
compileall.py52850644editdlrm
compileall.pyc49970644editdlrm
compileall.pyo49970644editdlrm
ConfigParser.py259890644editdlrm
ConfigParser.pyc238650644editdlrm
ConfigParser.pyo238650644editdlrm
contextlib.py41360644editdlrm
contextlib.pyc41510644editdlrm
contextlib.pyo41510644editdlrm
Cookie.py250540644editdlrm
Cookie.pyc221450644editdlrm
Cookie.pyo221450644editdlrm
cookielib.py647260644editdlrm
cookielib.pyc553700644editdlrm
cookielib.pyo551790644editdlrm
copy.py111770644editdlrm
copy.pyc116750644editdlrm
copy.pyo115790644editdlrm
copy_reg.py68000644editdlrm
copy_reg.pyc51780644editdlrm
copy_reg.pyo51320644editdlrm
cProfile.py63370755editdlrm
cProfile.pyc62390644editdlrm
cProfile.pyo62390644editdlrm
crypt.py22290644editdlrm
crypt.pyc30550644editdlrm
crypt.pyo30550644editdlrm
csv.py157300644editdlrm
csv.pyc132260644editdlrm
csv.pyo132260644editdlrm
dbhash.py5350644editdlrm
dbhash.pyc7600644editdlrm
dbhash.pyo7600644editdlrm
decimal.py1992730644editdlrm
decimal.pyc1556810644editdlrm
decimal.pyo1556150644editdlrm
difflib.py810800644editdlrm
difflib.pyc611930644editdlrm
difflib.pyo611390644editdlrm
dircache.py11260644editdlrm
dircache.pyc15840644editdlrm
dircache.pyo15840644editdlrm
dis.py64490644editdlrm
dis.pyc63660644editdlrm
dis.pyo63660644editdlrm
doctest.py1015160644editdlrm
doctest.pyc809940644editdlrm
doctest.pyo807060644editdlrm
DocXMLRPCServer.py105990644editdlrm
DocXMLRPCServer.pyc99570644editdlrm
DocXMLRPCServer.pyo98490644editdlrm
dumbdbm.py88200644editdlrm
dumbdbm.pyc65850644editdlrm
dumbdbm.pyo65850644editdlrm
dummy_thread.py44180644editdlrm
dummy_thread.pyc54130644editdlrm
dummy_thread.pyo54130644editdlrm
dummy_threading.py28040644editdlrm
dummy_threading.pyc12970644editdlrm
dummy_threading.pyo12970644editdlrm
filecmp.py94700644editdlrm
filecmp.pyc96320644editdlrm
filecmp.pyo96320644editdlrm
fileinput.py141430644editdlrm
fileinput.pyc149280644editdlrm
fileinput.pyo149280644editdlrm
fnmatch.py32390644editdlrm
fnmatch.pyc35790644editdlrm
fnmatch.pyo35790644editdlrm
formatter.py149110644editdlrm
formatter.pyc193030644editdlrm
formatter.pyo193030644editdlrm
fpformat.py46990644editdlrm
fpformat.pyc47350644editdlrm
fpformat.pyo47350644editdlrm
fractions.py200730644editdlrm
fractions.pyc181190644editdlrm
fractions.pyo181190644editdlrm
ftplib.py291970644editdlrm
ftplib.pyc285030644editdlrm
ftplib.pyo285030644editdlrm
functools.py21620644editdlrm
functools.pyc19270644editdlrm
functools.pyo19270644editdlrm
genericpath.py30200644editdlrm
genericpath.pyc32920644editdlrm
genericpath.pyo32920644editdlrm
getopt.py73280644editdlrm
getopt.pyc67300644editdlrm
getopt.pyo66830644editdlrm
getpass.py55340644editdlrm
getpass.pyc47540644editdlrm
getpass.pyo47540644editdlrm
gettext.py199680644editdlrm
gettext.pyc157600644editdlrm
gettext.pyo157600644editdlrm
glob.py22490644editdlrm
glob.pyc24090644editdlrm
glob.pyo24090644editdlrm
gzip.py167540644editdlrm
gzip.pyc143860644editdlrm
gzip.pyo143860644editdlrm
hashlib.py44270644editdlrm
hashlib.pyc39810644editdlrm
hashlib.pyo39810644editdlrm
heapq.py159950644editdlrm
heapq.pyc126940644editdlrm
heapq.pyo126940644editdlrm
hmac.py45310644editdlrm
hmac.pyc45090644editdlrm
hmac.pyo45090644editdlrm
htmlentitydefs.py180540644editdlrm
htmlentitydefs.pyc63710644editdlrm
htmlentitydefs.pyo63710644editdlrm
htmllib.py128690644editdlrm
htmllib.pyc203840644editdlrm
htmllib.pyo203840644editdlrm
HTMLParser.py135760644editdlrm
HTMLParser.pyc122580644editdlrm
HTMLParser.pyo119500644editdlrm
httplib.py487970644editdlrm
httplib.pyc377320644editdlrm
httplib.pyo375360644editdlrm
ihooks.py174520644editdlrm
ihooks.pyc208370644editdlrm
ihooks.pyo207580644editdlrm
imaplib.py477710644editdlrm
imaplib.pyc452250644editdlrm
imaplib.pyo424750644editdlrm
imghdr.py35440644editdlrm
imghdr.pyc49050644editdlrm
imghdr.pyo49050644editdlrm
imputil.py260090644editdlrm
imputil.pyc160370644editdlrm
imputil.pyo158650644editdlrm
inspect.py381890644editdlrm
inspect.pyc371650644editdlrm
inspect.pyo371650644editdlrm
io.py661650644editdlrm
io.pyc630420644editdlrm
io.pyo630420644editdlrm
keyword.py19970755editdlrm
keyword.pyc21170644editdlrm
keyword.pyo21170644editdlrm
linecache.py41280644editdlrm
linecache.pyc32680644editdlrm
linecache.pyo32680644editdlrm
locale.py826740644editdlrm
locale.pyc466760644editdlrm
locale.pyo466760644editdlrm
macpath.py62530644editdlrm
macpath.pyc77070644editdlrm
macpath.pyo77070644editdlrm
macurl2path.py32750644editdlrm
macurl2path.pyc28250644editdlrm
macurl2path.pyo28250644editdlrm
mailbox.py758240644editdlrm
mailbox.pyc760690644editdlrm
mailbox.pyo760200644editdlrm
mailcap.py84020644editdlrm
mailcap.pyc80790644editdlrm
mailcap.pyo80790644editdlrm
markupbase.py143500644editdlrm
markupbase.pyc94640644editdlrm
markupbase.pyo92700644editdlrm
md5.py4100644editdlrm
md5.pyc3780644editdlrm
md5.pyo3780644editdlrm
mhlib.py334340644editdlrm
mhlib.pyc341370644editdlrm
mhlib.pyo341370644editdlrm
mimetools.py71680644editdlrm
mimetools.pyc83200644editdlrm
mimetools.pyo83200644editdlrm
mimetypes.py188220644editdlrm
mimetypes.pyc168720644editdlrm
mimetypes.pyo168720644editdlrm
MimeWriter.py64820644editdlrm
MimeWriter.pyc73830644editdlrm
MimeWriter.pyo73830644editdlrm
mimify.py150240755editdlrm
mimify.pyc122190644editdlrm
mimify.pyo122190644editdlrm
modulefinder.py242830644editdlrm
modulefinder.pyc190070644editdlrm
modulefinder.pyo189190644editdlrm
multifile.py48200644editdlrm
multifile.pyc54790644editdlrm
multifile.pyo54350644editdlrm
mutex.py18660644editdlrm
mutex.pyc25260644editdlrm
mutex.pyo25260644editdlrm
netrc.py41110644editdlrm
netrc.pyc36020644editdlrm
netrc.pyo36020644editdlrm
new.py7060644editdlrm
new.pyc9100644editdlrm
new.pyo9100644editdlrm
nntplib.py214700644editdlrm
nntplib.pyc211790644editdlrm
nntplib.pyo211790644editdlrm
ntpath.py177520644editdlrm
ntpath.pyc116200644editdlrm
ntpath.pyo115730644editdlrm
nturl2path.py22390644editdlrm
nturl2path.pyc17770644editdlrm
nturl2path.pyo17770644editdlrm
numbers.py102710644editdlrm
numbers.pyc139640644editdlrm
numbers.pyo139640644editdlrm
opcode.py52480644editdlrm
opcode.pyc59170644editdlrm
opcode.pyo59170644editdlrm
optparse.py608490644editdlrm
optparse.pyc542390644editdlrm
optparse.pyo541570644editdlrm
ordereddict.py360644editdlrm
ordereddict.pyc1850644editdlrm
ordereddict.pyo1850644editdlrm
os.py258020644editdlrm
os.pyc258080644editdlrm
os.pyo258080644editdlrm
os2emxpath.py46030644editdlrm
os2emxpath.pyc45360644editdlrm
os2emxpath.pyo45360644editdlrm
pdb.doc78990644editdlrm
pdb.py453330755editdlrm
pdb.pyc438130644editdlrm
pdb.pyo438130644editdlrm
pickle.py448110644editdlrm
pickle.pyc386450644editdlrm
pickle.pyo384400644editdlrm
pickletools.py743480644editdlrm
pickletools.pyc571430644editdlrm
pickletools.pyo562460644editdlrm
pipes.py96470644editdlrm
pipes.pyc94600644editdlrm
pipes.pyo94600644editdlrm
pkgutil.py200010644editdlrm
pkgutil.pyc190200644editdlrm
pkgutil.pyo190200644editdlrm
platform.py526300755editdlrm
platform.pyc387970644editdlrm
platform.pyo387970644editdlrm
plistlib.py158060644editdlrm
plistlib.pyc200500644editdlrm
plistlib.pyo199600644editdlrm
popen2.py84160644editdlrm
popen2.pyc90640644editdlrm
popen2.pyo90200644editdlrm
poplib.py128250644editdlrm
poplib.pyc134180644editdlrm
poplib.pyo134180644editdlrm
posixfile.py80030644editdlrm
posixfile.pyc77240644editdlrm
posixfile.pyo77240644editdlrm
posixpath.py131190644editdlrm
posixpath.pyc111880644editdlrm
posixpath.pyo111880644editdlrm
pprint.py119320644editdlrm
pprint.pyc103940644editdlrm
pprint.pyo102190644editdlrm
profile.py235100755editdlrm
profile.pyc166800644editdlrm
profile.pyo164350644editdlrm
pstats.py273100644editdlrm
pstats.pyc253400644editdlrm
pstats.pyo253400644editdlrm
pty.py48690644editdlrm
pty.pyc49190644editdlrm
pty.pyo49190644editdlrm
pyclbr.py132820644editdlrm
pyclbr.pyc97320644editdlrm
pyclbr.pyo97320644editdlrm
pydoc.py924320755editdlrm
pydoc.pyc910520644editdlrm
pydoc.pyo909840644editdlrm
pydoc_topics.py4231260644editdlrm
pydoc_topics.pyc4075880644editdlrm
pydoc_topics.pyo4075880644editdlrm
py_compile.py56330644editdlrm
py_compile.pyc65540644editdlrm
py_compile.pyo65540644editdlrm
Queue.py85740644editdlrm
Queue.pyc94470644editdlrm
Queue.pyo94470644editdlrm
quopri.py69720755editdlrm
quopri.pyc66880644editdlrm
quopri.pyo66880644editdlrm
random.py319660644editdlrm
random.pyc251060644editdlrm
random.pyo251060644editdlrm
re.py129660644editdlrm
re.pyc131640644editdlrm
re.pyo131640644editdlrm
repr.py42960644editdlrm
repr.pyc54340644editdlrm
repr.pyo54340644editdlrm
rexec.py201520644editdlrm
rexec.pyc242200644editdlrm
rexec.pyo242200644editdlrm
rfc822.py332950644editdlrm
rfc822.pyc321100644editdlrm
rfc822.pyo321100644editdlrm
rlcompleter.py58660644editdlrm
rlcompleter.pyc60730644editdlrm
rlcompleter.pyo60730644editdlrm
robotparser.py70140644editdlrm
robotparser.pyc78520644editdlrm
robotparser.pyo78520644editdlrm
runpy.py54130644editdlrm
runpy.pyc39790644editdlrm
runpy.pyo39790644editdlrm
sched.py50910644editdlrm
sched.pyc50050644editdlrm
sched.pyo50050644editdlrm
sets.py190500644editdlrm
sets.pyc169970644editdlrm
sets.pyo169970644editdlrm
sgmllib.py178840644editdlrm
sgmllib.pyc155980644editdlrm
sgmllib.pyo155980644editdlrm
sha.py4450644editdlrm
sha.pyc4210644editdlrm
sha.pyo4210644editdlrm
shelve.py80780644editdlrm
shelve.pyc102960644editdlrm
shelve.pyo102960644editdlrm
shlex.py111370644editdlrm
shlex.pyc77100644editdlrm
shlex.pyo77100644editdlrm
shutil.py86320644editdlrm
shutil.pyc95550644editdlrm
shutil.pyo95550644editdlrm
SimpleHTTPServer.py74220644editdlrm
SimpleHTTPServer.pyc77660644editdlrm
SimpleHTTPServer.pyo77660644editdlrm
SimpleXMLRPCServer.py219920644editdlrm
SimpleXMLRPCServer.pyc196330644editdlrm
SimpleXMLRPCServer.pyo196330644editdlrm
site.py191870644editdlrm
site.pyc188250644editdlrm
site.pyo188250644editdlrm
smtpd.py189200755editdlrm
smtpd.pyc161880644editdlrm
smtpd.pyo161880644editdlrm
smtplib.py309240755editdlrm
smtplib.pyc297370644editdlrm
smtplib.pyo297370644editdlrm
sndhdr.py59730644editdlrm
sndhdr.pyc74200644editdlrm
sndhdr.pyo74200644editdlrm
socket.py201490644editdlrm
socket.pyc161290644editdlrm
socket.pyo160440644editdlrm
SocketServer.py223260644editdlrm
SocketServer.pyc231430644editdlrm
SocketServer.pyo231430644editdlrm
sre.py3840644editdlrm
sre.pyc5190644editdlrm
sre.pyo5190644editdlrm
sre_compile.py165070644editdlrm
sre_compile.pyc114830644editdlrm
sre_compile.pyo113700644editdlrm
sre_constants.py71370644editdlrm
sre_constants.pyc60930644editdlrm
sre_constants.pyo60930644editdlrm
sre_parse.py268780644editdlrm
sre_parse.pyc196960644editdlrm
sre_parse.pyo196960644editdlrm
ssl.py166770644editdlrm
ssl.pyc142760644editdlrm
ssl.pyo142760644editdlrm
stat.py17180644editdlrm
stat.pyc27030644editdlrm
stat.pyo27030644editdlrm
statvfs.py8980644editdlrm
statvfs.pyc6200644editdlrm
statvfs.pyo6200644editdlrm
string.py207450644editdlrm
string.pyc200660644editdlrm
string.pyo200660644editdlrm
StringIO.py106210644editdlrm
StringIO.pyc115320644editdlrm
StringIO.pyo115320644editdlrm
stringold.py124490644editdlrm
stringold.pyc125930644editdlrm
stringold.pyo125930644editdlrm
stringprep.py135220644editdlrm
stringprep.pyc145260644editdlrm
stringprep.pyo144520644editdlrm
struct.py820644editdlrm
struct.pyc2390644editdlrm
struct.pyo2390644editdlrm
subprocess.py579450644editdlrm
subprocess.pyc410710644editdlrm
subprocess.pyo410140644editdlrm
sunau.py165370644editdlrm
sunau.pyc180720644editdlrm
sunau.pyo180720644editdlrm
sunaudio.py13990644editdlrm
sunaudio.pyc19970644editdlrm
sunaudio.pyo19970644editdlrm
symbol.py20500755editdlrm
symbol.pyc30250644editdlrm
symbol.pyo30250644editdlrm
symtable.py79110644editdlrm
symtable.pyc126090644editdlrm
symtable.pyo124790644editdlrm
tabnanny.py113390755editdlrm
tabnanny.pyc83330644editdlrm
tabnanny.pyo83330644editdlrm
tarfile.py877860644editdlrm
tarfile.pyc739220644editdlrm
tarfile.pyo739220644editdlrm
telnetlib.py218080644editdlrm
telnetlib.pyc199130644editdlrm
telnetlib.pyo199130644editdlrm
tempfile.py177740644editdlrm
tempfile.pyc195710644editdlrm
tempfile.pyo195710644editdlrm
textwrap.py168890644editdlrm
textwrap.pyc117920644editdlrm
textwrap.pyo117000644editdlrm
this.py10020644editdlrm
this.pyc12410644editdlrm
this.pyo12410644editdlrm
threading.py318080644editdlrm
threading.pyc281520644editdlrm
threading.pyo260800644editdlrm
timeit.py120030644editdlrm
timeit.pyc118270644editdlrm
timeit.pyo118270644editdlrm
toaiff.py31420644editdlrm
toaiff.pyc31340644editdlrm
toaiff.pyo31340644editdlrm
token.py29470755editdlrm
token.pyc38400644editdlrm
token.pyo38400644editdlrm
tokenize.py163260644editdlrm
tokenize.pyc140180644editdlrm
tokenize.pyo139250644editdlrm
trace.py303250644editdlrm
trace.pyc230510644editdlrm
trace.pyo229890644editdlrm
traceback.py112110644editdlrm
traceback.pyc116770644editdlrm
traceback.pyo116770644editdlrm
tty.py8790644editdlrm
tty.pyc13170644editdlrm
tty.pyo13170644editdlrm
types.py23230644editdlrm
types.pyc26200644editdlrm
types.pyo26200644editdlrm
unittest.py311570644editdlrm
unittest.pyc348620644editdlrm
unittest.pyo348620644editdlrm
urllib.py590220644editdlrm
urllib.pyc513480644editdlrm
urllib.pyo512540644editdlrm
urllib2.py508660644editdlrm
urllib2.pyc458130644editdlrm
urllib2.pyo457190644editdlrm
urlparse.py156180644editdlrm
urlparse.pyc147770644editdlrm
urlparse.pyo147770644editdlrm
user.py16270644editdlrm
user.pyc17360644editdlrm
user.pyo17360644editdlrm
UserDict.py57780644editdlrm
UserDict.pyc88920644editdlrm
UserDict.pyo88920644editdlrm
UserList.py36440644editdlrm
UserList.pyc66030644editdlrm
UserList.pyo66030644editdlrm
UserString.py96910755editdlrm
UserString.pyc149220644editdlrm
UserString.pyo149220644editdlrm
uu.py59420755editdlrm
uu.pyc42370644editdlrm
uu.pyo42370644editdlrm
uuid.py209440644editdlrm
uuid.pyc212790644editdlrm
uuid.pyo212790644editdlrm
warnings.py141720644editdlrm
warnings.pyc130420644editdlrm
warnings.pyo122050644editdlrm
wave.py179520644editdlrm
wave.pyc194360644editdlrm
wave.pyo194360644editdlrm
weakref.py100870644editdlrm
weakref.pyc133750644editdlrm
weakref.pyo133750644editdlrm
webbrowser.py210730644editdlrm
webbrowser.pyc187550644editdlrm
webbrowser.pyo187080644editdlrm
whichdb.py33530644editdlrm
whichdb.pyc22470644editdlrm
whichdb.pyo22470644editdlrm
xdrlib.py55130644editdlrm
xdrlib.pyc91570644editdlrm
xdrlib.pyo91570644editdlrm
xmllib.py348650644editdlrm
xmllib.pyc272740644editdlrm
xmllib.pyo272740644editdlrm
xmlrpclib.py477750644editdlrm
xmlrpclib.pyc414960644editdlrm
xmlrpclib.pyo413130644editdlrm
zipfile.py530920644editdlrm
zipfile.pyc376520644editdlrm
zipfile.pyo376520644editdlrm
_abcoll.py142420644editdlrm
_abcoll.pyc215910644editdlrm
_abcoll.pyo215910644editdlrm
_LWPCookieJar.py65530644editdlrm
_LWPCookieJar.pyc56010644editdlrm
_LWPCookieJar.pyo56010644editdlrm
_MozillaCookieJar.py58090644editdlrm
_MozillaCookieJar.pyc45170644editdlrm
_MozillaCookieJar.pyo44760644editdlrm
_strptime.py197540644editdlrm
_strptime.pyc149660644editdlrm
_strptime.pyo149660644editdlrm
_threading_local.py71140644editdlrm
_threading_local.pyc63850644editdlrm
_threading_local.pyo63850644editdlrm
__future__.py43800644editdlrm
__future__.pyc42330644editdlrm
__future__.pyo42330644editdlrm
__phello__.foo.py640644editdlrm
__phello__.foo.pyc1250644editdlrm
__phello__.foo.pyo1250644editdlrm
Edit: /usr/lib64/python2.6/decimal.pyo (155615B)
gc @sAdZddddddddd d d d d ddddddddddddgZddkZddkZy#ddklZeddZ Wne j odZ nXdZ dZ dZ dZdZdZdZdZdefd YZdefd!YZdefd"YZd#efd$YZd eefd%YZd&efd'YZd(eefd)YZd efd*YZd+efd,YZd efd-YZd efd.YZd eefd/YZ deeefd0YZ!eeee ee!eegZ"hee6ee6ee6ee6Z#yddk$Z$WnDe j o8ddk%Z%d1e&fd2YZ'e'Z$[%['nXy e$i(WnKe)j o?e*e$i+d3oe$i+`,nd4Z-d5Z.nFXe$i(Z(e*e(d3o e(`,ne(d6Z.e(d7Z-[$[(e/d8Z0de&fd9YZ1e2d:Z3ei4i5e1gZ6e1i7i8D]!Z9e9i:d;o e6e9nq[6Z;x8e;D]0Z9e9d<i<Z=e>e=Z?e9e1i@e?YZAde&fd?YZBd@e&fdAYZCdBdCZDhdDdE6dFdG6dHdI6dHdJ6d<dK6d<dL6d<dM6d<dN6dBdO6dBdP6dBdQ6dBdR6dBdS6dBdT6dBdU6dBdV6dWZEdXZFdYZGdZZHd[d\ZId]ZJd^ZKd_e&fd`YZLeLiMZNd[daZOdbZPdcZQh dddG6dedI6dfdJ6dgdK6dhdL6didM6djdN6dkdO6dldP6dmZRe2dnZSeBdodpdqe dree egdsgdtdudvdwdxd<ZTeBdodydqe dree eee!gdsgZUeBdodydqe drgdsgZVddkWZWeWiXdzeWiYeWiZBeWi[Bi\Z]eWiXd{i\Z^eWiXd|i\Z_eWiXd}eWiYZ`[Wd~ZadZbe1dZce1dZde1dZee1dBZfe1d<Zge1dZhecedfZiejdjo0ddkkZkddk%Z%ekile%imejndS(s This is a Py2.3 implementation of decimal floating point arithmetic based on the General Decimal Arithmetic Specification: www2.hursley.ibm.com/decimal/decarith.html and IEEE standard 854-1987: www.cs.berkeley.edu/~ejr/projects/754/private/drafts/854-1987/dir.html Decimal floating point has finite precision with arbitrarily large bounds. The purpose of this module is to support arithmetic using familiar "schoolhouse" rules and to avoid some of the tricky representation issues associated with binary floating point. The package is especially useful for financial applications or for contexts where users have expectations that are at odds with binary floating point (for instance, in binary floating point, 1.00 % 0.1 gives 0.09999999999999995 instead of the expected Decimal('0.00') returned by decimal floating point). Here are some examples of using the decimal module: >>> from decimal import * >>> setcontext(ExtendedContext) >>> Decimal(0) Decimal('0') >>> Decimal('1') Decimal('1') >>> Decimal('-.0123') Decimal('-0.0123') >>> Decimal(123456) Decimal('123456') >>> Decimal('123.45e12345678901234567890') Decimal('1.2345E+12345678901234567892') >>> Decimal('1.33') + Decimal('1.27') Decimal('2.60') >>> Decimal('12.34') + Decimal('3.87') - Decimal('18.41') Decimal('-2.20') >>> dig = Decimal(1) >>> print dig / Decimal(3) 0.333333333 >>> getcontext().prec = 18 >>> print dig / Decimal(3) 0.333333333333333333 >>> print dig.sqrt() 1 >>> print Decimal(3).sqrt() 1.73205080756887729 >>> print Decimal(3) ** 123 4.85192780976896427E+58 >>> inf = Decimal(1) / Decimal(0) >>> print inf Infinity >>> neginf = Decimal(-1) / Decimal(0) >>> print neginf -Infinity >>> print neginf + inf NaN >>> print neginf * inf -Infinity >>> print dig / 0 Infinity >>> getcontext().traps[DivisionByZero] = 1 >>> print dig / 0 Traceback (most recent call last): ... ... ... DivisionByZero: x / 0 >>> c = Context() >>> c.traps[InvalidOperation] = 0 >>> print c.flags[InvalidOperation] 0 >>> c.divide(Decimal(0), Decimal(0)) Decimal('NaN') >>> c.traps[InvalidOperation] = 1 >>> print c.flags[InvalidOperation] 1 >>> c.flags[InvalidOperation] = 0 >>> print c.flags[InvalidOperation] 0 >>> print c.divide(Decimal(0), Decimal(0)) Traceback (most recent call last): ... ... ... InvalidOperation: 0 / 0 >>> print c.flags[InvalidOperation] 1 >>> c.flags[InvalidOperation] = 0 >>> c.traps[InvalidOperation] = 0 >>> print c.divide(Decimal(0), Decimal(0)) NaN >>> print c.flags[InvalidOperation] 1 >>> tDecimaltContexttDefaultContextt BasicContexttExtendedContexttDecimalExceptiontClampedtInvalidOperationtDivisionByZerotInexacttRoundedt SubnormaltOverflowt Underflowt ROUND_DOWNt ROUND_HALF_UPtROUND_HALF_EVENt ROUND_CEILINGt ROUND_FLOORtROUND_UPtROUND_HALF_DOWNt ROUND_05UPt setcontextt getcontextt localcontextiN(t namedtuplet DecimalTuplessign digits exponentcGs|S(((targs((s/usr/lib64/python2.6/decimal.pytscBseZdZdZRS(s1Base exception class. Used exceptions derive from this. If an exception derives from another exception besides this (such as Underflow (Inexact, Rounded, Subnormal) that indicates that it is only called if the others are present. This isn't actually used for anything, though. handle -- Called when context._raise_error is called and the trap_enabler is not set. First argument is self, second is the context. More arguments can be given, those being after the explanation in _raise_error (For example, context._raise_error(NewError, '(-x)!', self._sign) would call NewError().handle(context, self._sign).) To define a new exception, it should be sufficient to have it derive from DecimalException. cGsdS(N((tselftcontextR((s/usr/lib64/python2.6/decimal.pythandles(t__name__t __module__t__doc__R(((s/usr/lib64/python2.6/decimal.pyRscBseZdZRS(s)Exponent of a 0 changed to fit bounds. This occurs and signals clamped if the exponent of a result has been altered in order to fit the constraints of a specific concrete representation. This may occur when the exponent of a zero result would be outside the bounds of a representation, or when a large normal number would have an encoded exponent that cannot be represented. In this latter case, the exponent is reduced to fit and the corresponding number of zero digits are appended to the coefficient ("fold-down"). (R R!R"(((s/usr/lib64/python2.6/decimal.pyRs cBseZdZdZRS(s0An invalid operation was performed. Various bad things cause this: Something creates a signaling NaN -INF + INF 0 * (+-)INF (+-)INF / (+-)INF x % 0 (+-)INF % x x._rescale( non-integer ) sqrt(-x) , x > 0 0 ** 0 x ** (non-integer) x ** (+-)INF An operand is invalid The result of the operation after these is a quiet positive NaN, except when the cause is a signaling NaN, in which case the result is also a quiet NaN, but with the original sign, and an optional diagnostic information. cGs<|o1t|di|didt}|i|StS(Nitn(t_dec_from_triplet_signt_inttTruet_fix_nant_NaN(RRRtans((s/usr/lib64/python2.6/decimal.pyRs#(R R!R"R(((s/usr/lib64/python2.6/decimal.pyRstConversionSyntaxcBseZdZdZRS(sTrying to convert badly formed string. This occurs and signals invalid-operation if an string is being converted to a number and it does not conform to the numeric string syntax. The result is [0,qNaN]. cGstS(N(R)(RRR((s/usr/lib64/python2.6/decimal.pyRs(R R!R"R(((s/usr/lib64/python2.6/decimal.pyR+scBseZdZdZRS(sDivision by 0. This occurs and signals division-by-zero if division of a finite number by zero was attempted (during a divide-integer or divide operation, or a power operation with negative right-hand operand), and the dividend was not zero. The result of the operation is [sign,inf], where sign is the exclusive or of the signs of the operands for divide, or is 1 for an odd power of -0, for power. cGst|S(N(t_SignedInfinity(RRtsignR((s/usr/lib64/python2.6/decimal.pyRs(R R!R"R(((s/usr/lib64/python2.6/decimal.pyRs tDivisionImpossiblecBseZdZdZRS(sCannot perform the division adequately. This occurs and signals invalid-operation if the integer result of a divide-integer or remainder operation had too many digits (would be longer than precision). The result is [0,qNaN]. cGstS(N(R)(RRR((s/usr/lib64/python2.6/decimal.pyRs(R R!R"R(((s/usr/lib64/python2.6/decimal.pyR.stDivisionUndefinedcBseZdZdZRS(sUndefined result of division. This occurs and signals invalid-operation if division by zero was attempted (during a divide-integer, divide, or remainder operation), and the dividend is also zero. The result is [0,qNaN]. cGstS(N(R)(RRR((s/usr/lib64/python2.6/decimal.pyR s(R R!R"R(((s/usr/lib64/python2.6/decimal.pyR/scBseZdZRS(sHad to round, losing information. This occurs and signals inexact whenever the result of an operation is not exact (that is, it needed to be rounded and any discarded digits were non-zero), or if an overflow or underflow condition occurs. The result in all cases is unchanged. The inexact signal may be tested (or trapped) to determine if a given operation (or sequence of operations) was inexact. (R R!R"(((s/usr/lib64/python2.6/decimal.pyR s tInvalidContextcBseZdZdZRS(sInvalid context. Unknown rounding, for example. This occurs and signals invalid-operation if an invalid context was detected during an operation. This can occur if contexts are not checked on creation and either the precision exceeds the capability of the underlying concrete representation or an unknown or unsupported rounding was specified. These aspects of the context need only be checked when the values are required to be used. The result is [0,qNaN]. cGstS(N(R)(RRR((s/usr/lib64/python2.6/decimal.pyR%s(R R!R"R(((s/usr/lib64/python2.6/decimal.pyR0s cBseZdZRS(sNumber got rounded (not necessarily changed during rounding). This occurs and signals rounded whenever the result of an operation is rounded (that is, some zero or non-zero digits were discarded from the coefficient), or if an overflow or underflow condition occurs. The result in all cases is unchanged. The rounded signal may be tested (or trapped) to determine if a given operation (or sequence of operations) caused a loss of precision. (R R!R"(((s/usr/lib64/python2.6/decimal.pyR (s cBseZdZRS(sExponent < Emin before rounding. This occurs and signals subnormal whenever the result of a conversion or operation is subnormal (that is, its adjusted exponent is less than Emin, before any rounding). The result in all cases is unchanged. The subnormal signal may be tested (or trapped) to determine if a given or operation (or sequence of operations) yielded a subnormal result. (R R!R"(((s/usr/lib64/python2.6/decimal.pyR 4s cBseZdZdZRS(sNumerical overflow. This occurs and signals overflow if the adjusted exponent of a result (from a conversion or from an operation that is not an attempt to divide by zero), after rounding, would be greater than the largest value that can be handled by the implementation (the value Emax). The result depends on the rounding mode: For round-half-up and round-half-even (and for round-half-down and round-up, if implemented), the result of the operation is [sign,inf], where sign is the sign of the intermediate result. For round-down, the result is the largest finite number that can be represented in the current precision, with the sign of the intermediate result. For round-ceiling, the result is the same as for round-down if the sign of the intermediate result is 1, or is [0,inf] otherwise. For round-floor, the result is the same as for round-down if the sign of the intermediate result is 0, or is [1,inf] otherwise. In all cases, Inexact and Rounded will also be raised. cGs|ittttfjo t|S|djo?|itjo t|St|d|i|i |idS|djo?|it jo t|St|d|i|i |idSdS(Nit9i( troundingRRRRR,RR$tprectEmaxR(RRR-R((s/usr/lib64/python2.6/decimal.pyRUs      (R R!R"R(((s/usr/lib64/python2.6/decimal.pyR ?scBseZdZRS(sxNumerical underflow with result rounded to 0. This occurs and signals underflow if a result is inexact and the adjusted exponent of the result would be smaller (more negative) than the smallest value that can be handled by the implementation (the value Emin). That is, the result is both inexact and subnormal. The result after an underflow will be a subnormal number rounded, if necessary, so that its exponent is not less than Etiny. This may result in 0 with the sign of the intermediate result and an exponent of Etiny. In all cases, Inexact, Rounded, and Subnormal will also be raised. (R R!R"(((s/usr/lib64/python2.6/decimal.pyR es t MockThreadingcBseZedZRS(cCs |itS(N(tmodulesR (Rtsys((s/usr/lib64/python2.6/decimal.pytlocals(R R!R7R8(((s/usr/lib64/python2.6/decimal.pyR5st__decimal_context__cCsC|tttfjo|i}|in|ti_dS(s%Set this thread's context to context.N(RRRtcopyt clear_flagst threadingt currentThreadR9(R((s/usr/lib64/python2.6/decimal.pyRs cCsDytiiSWn,tj o t}|ti_|SXdS(sReturns this thread's context. If this thread does not yet have a context, returns a new context and sets this thread's context. New contexts are copies of DefaultContext. N(R<R=R9tAttributeErrorR(R((s/usr/lib64/python2.6/decimal.pyRs  cCs8y |iSWn&tj ot}||_|SXdS(sReturns this thread's context. If this thread does not yet have a context, returns a new context and sets this thread's context. New contexts are copies of DefaultContext. N(R9R>R(t_localR((s/usr/lib64/python2.6/decimal.pyRs    cCs=|tttfjo|i}|in||_dS(s%Set this thread's context to context.N(RRRR:R;R9(RR?((s/usr/lib64/python2.6/decimal.pyRs cCs$|djo t}nt|S(s^Return a context manager for a copy of the supplied context Uses a copy of the current context if no context is specified The returned context manager creates a local decimal context in a with statement: def sin(x): with localcontext() as ctx: ctx.prec += 2 # Rest of sin calculation algorithm # uses a precision 2 greater than normal return +s # Convert result to normal precision def sin(x): with localcontext(ExtendedContext): # Rest of sin calculation algorithm # uses the Extended Context from the # General Decimal Arithmetic Specification return +s # Convert result to normal context >>> setcontext(DefaultContext) >>> print getcontext().prec 28 >>> with localcontext(): ... ctx = getcontext() ... ctx.prec += 2 ... print ctx.prec ... 30 >>> with localcontext(ExtendedContext): ... print getcontext().prec ... 9 >>> print getcontext().prec 28 N(tNoneRt_ContextManager(tctx((s/usr/lib64/python2.6/decimal.pyRs$ cBs!eZdZdxZddydZdZdZdydyd Zd Z d Z d Z d Z dZ dydZdydZdydZdydZdydZdZdZdZedydZdydZdydZdydZedydZdydZeZdydZdydZ dydZ!e!Z"dyd Z#d!Z$dyd"Z%e#Z&e%Z'dyd#Z(dyd$Z)dyd%Z*dyd&Z+dyd'Z,dyd(Z-dyd)Z.d*Z/d+Z0e0Z1d,Z2e3e2Z2d-Z4e3e4Z4d.Z5d/Z6d0Z7d1Z8d2Z9hZ:d3Z;d4Z<d5Z=d6Z>d7Z?d8Z@d9ZAd:ZBdyd;ZCdyd<ZDd=ZEdydyd>ZFdyd?ZGdyd@ZHdydyedAZIdBZJdCZKdDZLdydydEZMdydydFZNeNZOdydGZPdydHZQdydIZRdJZSdKZTdLZUdydMZVdydNZWdOZXdPZYdQZZdRZ[dSZ\dydTZ]dUZ^dVZ_dWZ`dXZadydYZbdZZcd[Zdd\Zedyd]Zfd^Zgd_Zhdyd`ZidaZjdydbZkdydcZlddZmdeZndydfZodydgZpdydhZqdydiZrdydjZsdydkZtdydlZudydmZvdydnZwdydoZxdpZydydqZzdydrZ{dydsZ|dtZ}duZ~dvZdydwZRS(zs,Floating point class for decimal arithmetic.t_expR&R%t _is_specialt0c Csti|}t|tot|i}|djo/|djo t}n|it d|S|i ddjo d|_ n d|_ |i d}|dj ok|i dpd}t |i d pd }t t |||_|t||_t|_n|i d }|dj oOt t |pd id |_|i d o d |_qd|_nd |_d|_t|_|St|t tfoO|djo d|_ n d|_ d|_t t||_t|_|St|to5|i|_|i |_ |i|_|i|_|St|to>|i|_ t |i |_t |i|_t|_|St|ttfot|djotdnt|dt tfo|ddjptdn|d|_ |ddjo#d |_|d|_t|_n0g} x{|dD]o} t| t tfoGd| jo djno)| p | djo| i| qqitdqiW|ddjo5dit t | |_|d|_t|_nft|dt tfo?dit t | pdg|_|d|_t|_n td|St|t!ot"ddnt"d|dS(sCreate a decimal point instance. >>> Decimal('3.14') # string input Decimal('3.14') >>> Decimal((0, (3, 1, 4), -2)) # tuple (sign, digit_tuple, exponent) Decimal('3.14') >>> Decimal(314) # int or long Decimal('314') >>> Decimal(Decimal(314)) # another decimal instance Decimal('314') >>> Decimal(' 3.14 \n') # leading and trailing whitespace okay Decimal('3.14') sInvalid literal for Decimal: %rR-t-iitinttfracttexpREtdiagtsignaltNR#tFistInvalid tuple size in creation of Decimal from list or tuple. The list or tuple should have exactly three elements.s|Invalid sign. The first value in the tuple should be an integer; either 0 for a positive number or 1 for a negative number.ii sTThe second value in the tuple must be composed of integers in the range 0 through 9.sUThe third value in the tuple must be an integer, or one of the strings 'F', 'n', 'N'.s"Cannot convert float to Decimal. s#First convert the float to a stringsCannot convert %r to DecimalN(ii(R#RM(#tobjectt__new__t isinstancet basestringt_parsertstripR@Rt _raise_errorR+tgroupR%RGtstrR&tlenRCtFalseRDtlstripR'tlongtabsRt_WorkRepR-RJtlistttuplet ValueErrortappendtjointmaptfloatt TypeError( tclstvalueRRtmtintparttfracpartRJRKtdigitstdigit((s/usr/lib64/python2.6/decimal.pyRPs          %                +     4  %   cCs?|io1|i}|djodS|djodSndS(srReturns whether the number is not actually one. 0 if a number 1 if NaN 2 if sNaN R#iRMii(RDRC(RRJ((s/usr/lib64/python2.6/decimal.pyt_isnans     cCs(|idjo|iodSdSdS(syReturns whether the number is infinite 0 if finite or not a number 1 if +INF -1 if -INF RNiii(RCR%(R((s/usr/lib64/python2.6/decimal.pyt _isinfinitys  cCs|i}|djo t}n |i}|p|o|djo t}n|djo|itd|S|djo|itd|S|o|i|S|i|SdS(sReturns whether the number is not actually one. if self, other are sNaN, signal if self, other are NaN return nan return 0 Done before operations. itsNaNiN(RmR@RYRRURR((RtotherRt self_is_nant other_is_nan((s/usr/lib64/python2.6/decimal.pyt _check_nanss"          cCs|djo t}n|ip |io|io|itd|S|io|itd|S|io|itd|S|io|itd|SndS(sCVersion of _check_nans used for the signaling comparisons compare_signal, __le__, __lt__, __ge__, __gt__. Signal InvalidOperation if either self or other is a (quiet or signaling) NaN. Signaling NaNs take precedence over quiet NaNs. Return 0 if neither operand is a NaN. scomparison involving sNaNscomparison involving NaNiN(R@RRDtis_snanRURtis_qnan(RRpR((s/usr/lib64/python2.6/decimal.pyt_compare_check_nanss(           cCs|ip |idjS(suReturn True if self is nonzero; otherwise return False. NaNs and infinities are considered nonzero. RE(RDR&(R((s/usr/lib64/python2.6/decimal.pyt __nonzero__scCs}|ip |ioD|i}|i}||jodS||jodSdSn|p|pdSd|i Sn|p d|iS|i|ijodS|i|ijodS|i}|i}||joq|id|i|i}|id|i|i}||jodS||jo d|i Sd|iSn&||jo d|iSd|i SdS(sCompare the two non-NaN decimal instances self and other. Returns -1 if self < other, 0 if self == other and 1 if self > other. This routine is for internal use only.iiiREN(RDRnR%tadjustedR&RC(RRptself_inft other_inft self_adjustedtother_adjustedt self_paddedt other_padded((s/usr/lib64/python2.6/decimal.pyt_cmps>             cCsPt|}|tjo|S|ip |iotS|i|djS(Ni(t_convert_othertNotImplementedtis_nanRYR(RRp((s/usr/lib64/python2.6/decimal.pyt__eq__.s   cCsPt|}|tjo|S|ip |iotS|i|djS(Ni(RRRR'R(RRp((s/usr/lib64/python2.6/decimal.pyt__ne__6s   cCsOt|}|tjo|S|i||}|otS|i|djS(Ni(RRRvRYR(RRpRR*((s/usr/lib64/python2.6/decimal.pyt__lt__>s  cCsOt|}|tjo|S|i||}|otS|i|djS(Ni(RRRvRYR(RRpRR*((s/usr/lib64/python2.6/decimal.pyt__le__Gs  cCsOt|}|tjo|S|i||}|otS|i|djS(Ni(RRRvRYR(RRpRR*((s/usr/lib64/python2.6/decimal.pyt__gt__Ps  cCsOt|}|tjo|S|i||}|otS|i|djS(Ni(RRRvRYR(RRpRR*((s/usr/lib64/python2.6/decimal.pyt__ge__Ys  cCsbt|dt}|ip|o,|io"|i||}|o|Snt|i|S(sCompares one to another. -1 => a < b 0 => a = b 1 => a > b NaN => one is NaN Like __cmp__, but returns Decimal instances. traiseit(RR'RDRsRR(RRpRR*((s/usr/lib64/python2.6/decimal.pytcomparebs  cCs|io.|iotdntt|S|pdS|io>t|i}td|i|i t d|i d St|i |i t|i|iidfS( sx.__hash__() <==> hash(x)sCannot hash a NaN value.iii ii@iREll(RDRmRethashRWt _isintegerR]tto_integral_valueR-RGtpowRJR%RCRXR&trstrip(Rtop((s/usr/lib64/python2.6/decimal.pyt__hash__us   , cCs(t|ittt|i|iS(seRepresents the number as a triple tuple. To show the internals exactly as they are. (RR%R_RcRGR&RC(R((s/usr/lib64/python2.6/decimal.pytas_tuplescCsdt|S(s0Represents the number as an instance of Decimal.s Decimal('%s')(RW(R((s/usr/lib64/python2.6/decimal.pyt__repr__sc Csddg|i}|ioL|idjo |dS|idjo|d|iS|d|iSn|it|i}|idjo|d jo |}nJ|p d }n9|id jo|d d d }n|d d d }|djo d }d d | |i}n]|t|ijo(|id |t|i}d}n|i| }d |i|}||jo d}n:|djo t}nddg|id||}||||S(sReturn string representation of the number in scientific notation. Captures all of the information in the underlying representation. RIRFRNtInfinityR#tNaNRoiiiREit.tetEs%+dN(R%RDRCR&RXR@Rtcapitals( RtengRR-t leftdigitstdotplaceRiRjRJ((s/usr/lib64/python2.6/decimal.pyt__str__s:           cCs|idtd|S(sConvert to engineering-type string. Engineering notation has an exponent which is a multiple of 3, so there are up to 3 digits left of the decimal place. Same rules for when in exponential and when as a value as in __str__. RR(RR'(RR((s/usr/lib64/python2.6/decimal.pyt to_eng_stringscCsv|io"|id|}|o|Sn|p|i}n |i}|djo t}n|i|S(sRReturns a copy with the sign switched. Rounds, if it has reason. RN(RDRstcopy_abst copy_negateR@Rt_fix(RRR*((s/usr/lib64/python2.6/decimal.pyt__neg__s     cCsv|io"|id|}|o|Sn|p|i}n t|}|djo t}n|i|S(shReturns a copy, unless it is a sNaN. Rounds the number (if more then precision digits) RN(RDRsRRR@RR(RRR*((s/usr/lib64/python2.6/decimal.pyt__pos__s     cCst|p |iS|io"|id|}|o|Sn|io|id|}n|id|}|S(sReturns the absolute value of self. If the keyword argument 'round' is false, do not round. The expression self.__abs__(round=False) is equivalent to self.copy_abs(). R(RRDRsR%RR(RtroundRR*((s/usr/lib64/python2.6/decimal.pyt__abs__s    c Cst|}|tjo|S|djo t}n|ip |io|i||}|o|S|io<|i|ijo|io|it dSt |S|io t |Snt |i |i }d}|i tjo|i|ijo d}n| oT| oLt |i|i}|o d}nt|d|}|i|}|S|pFt||i |id}|i||i }|i|}|S|pFt||i |id}|i||i }|i|}|St|}t|}t|||i\}}t} |i|ijo|i|ijo&t|d|}|i|}|S|i|ijo||}}n|idjo&d| _|i|i|_|_q4d| _n9|idjod| _d\|_|_n d| _|idjo|i|i| _n|i|i| _|i| _t | }|i|}|S(sbReturns self + other. -INF + INF (or the reverse) cause InvalidOperation errors. s -INF + INFiiREN(ii(RRR@RRDRsRnR%RURRtminRCR2RR$RtmaxR3t_rescaleR]t _normalizeR-RGRJ( RRpRR*RJt negativezeroR-top1top2tresult((s/usr/lib64/python2.6/decimal.pyt__add__s|        #           cCspt|}|tjo|S|ip |io%|i|d|}|o|Sn|i|id|S(sReturn self - otherR(RRRDRsRR(RRpRR*((s/usr/lib64/python2.6/decimal.pyt__sub__ss   cCs1t|}|tjo|S|i|d|S(sReturn other - selfR(RRR(RRpR((s/usr/lib64/python2.6/decimal.pyt__rsub__s  cCst|}|tjo|S|djo t}n|i|iA}|ip |io~|i||}|o|S|io!|p|it dSt |S|io!|p|it dSt |Sn|i |i }| p| o&t |d|}|i |}|S|idjo)t ||i|}|i |}|S|idjo)t ||i|}|i |}|St|}t|}t |t|i|i|}|i |}|S(s\Return self * other. (+-) INF * 0 (or its reverse) raise InvalidOperation. s (+-)INF * 0s 0 * (+-)INFREt1N(RRR@RR%RDRsRnRURR,RCR$RR&R]RWRG(RRpRt resultsignR*t resultexpRR((s/usr/lib64/python2.6/decimal.pyt__mul__sH          "c Cst|}|tjotS|d jo t}n|i|iA}|ip |io|i||}|o|S|io|io|it dS|io t |S|io'|it dt |d|i Sn|p,|p|itdS|itd|S|p|i|i}d}n t|it|i|id}|i|i|}t|}t|} |djo't|id|| i\}} n%t|i| id| \}} | o#|d djo|d7}qfnK|i|i} x7|| jo)|ddjo|d}|d7}q/Wt |t||}|i|S( sReturn self / other.s(+-)INF/(+-)INFsDivision by infinityREs0 / 0sx / 0iii iN(RRR@RR%RDRsRnRURR,RR$tEtinyR/RRCRXR&R3R]tdivmodRGRWR( RRpRR-R*RJtcoefftshiftRRt remaindert ideal_exp((s/usr/lib64/python2.6/decimal.pyt __truediv__sR        '   '$ c Cs|i|iA}|io |i}nt|i|i}|i|i}| p|ip |djo&t|dd|i||ifS||ijot |}t |}|i |i jo!|i d|i |i 9_ n|i d|i |i 9_ t |i |i \}} |d|ijo2t|t |dt|it | |fSn|itd} | | fS(sReturn (self // other, self % other), to context.prec precision. Assumes that neither self nor other is a NaN, that self is not infinite and that other is nonzero. iREii s%quotient too large in //, % or divmod(R%RnRCRRxR$RR2R3R]RJRGRRWRUR.( RRpRR-RtexpdiffRRtqtrR*((s/usr/lib64/python2.6/decimal.pyt_divides*  "  !!  cCs1t|}|tjo|S|i|d|S(s)Swaps self/other and returns __truediv__.R(RRR(RRpR((s/usr/lib64/python2.6/decimal.pyt __rtruediv__s  cCsFt|}|tjo|S|djo t}n|i||}|o ||fS|i|iA}|ioH|io|itd}||fSt ||itdfSn|pM|p|it d}||fS|it d||itdfSn|i ||\}}|i |}||fS(s6 Return (self // other, self % other) sdivmod(INF, INF)sINF % xs divmod(0, 0)sx // 0sx % 0N(RRR@RRsR%RnRURR,R/RRR(RRpRR*R-tquotientR((s/usr/lib64/python2.6/decimal.pyt __divmod__(s0         cCs1t|}|tjo|S|i|d|S(s(Swaps self/other and returns __divmod__.R(RRR(RRpR((s/usr/lib64/python2.6/decimal.pyt __rdivmod__Ls  cCst|}|tjo|S|djo t}n|i||}|o|S|io|itdS|p,|o|itdS|itdSn|i ||d}|i |}|S(s self % other sINF % xsx % 0s0 % 0iN( RRR@RRsRnRURR/RR(RRpRR*R((s/usr/lib64/python2.6/decimal.pyt__mod__Ss"     cCs1t|}|tjo|S|i|d|S(s%Swaps self/other and returns __mod__.R(RRR(RRpR((s/usr/lib64/python2.6/decimal.pyt__rmod__ns  c Cs|d jo t}nt|dt}|i||}|o|S|io|itdS|p,|o|itdS|itdSn|iot |}|i |St |i |i }|p#t |id|}|i |S|i|i}||idjo|itS|djo#|i||i}|i |St|}t|}|i|ijo!|id|i|i9_n|id|i|i9_t|i|i\}} d | |d@|ijo| |i8} |d7}n|d|ijo|itS|i} | d jod| } | } nt | t| |}|i |S( sI Remainder nearest to 0- abs(remainder-near) <= other/2 Rsremainder_near(infinity, x)sremainder_near(x, 0)sremainder_near(0, 0)REiii iiN(R@RRR'RsRnRURR/RRRRCR$R%RxR3R.RR2R]RJRGRRW( RRpRR*tideal_exponentRRRRRR-((s/usr/lib64/python2.6/decimal.pytremainder_nearusZ            !     cCst|}|tjo|S|djo t}n|i||}|o|S|io4|io|itdSt|i |i ASn|p9|o|it d|i |i AS|it dSn|i ||dS(s self // others INF // INFsx // 0s0 // 0iN( RRR@RRsRnRURR,R%RR/R(RRpRR*((s/usr/lib64/python2.6/decimal.pyt __floordiv__s$       cCs1t|}|tjo|S|i|d|S(s*Swaps self/other and returns __floordiv__.R(RRR(RRpR((s/usr/lib64/python2.6/decimal.pyt __rfloordiv__s  cCstt|S(sFloat representation.(RdRW(R((s/usr/lib64/python2.6/decimal.pyt __float__scCs|io>|iotdqH|iotdqHnd|i}|idjo|t|id|iS|t|i|i pdSdS(s1Converts self to an int, truncating if necessary.sCannot convert NaN to integers"Cannot convert infinity to integeriii REN( RDRmR`Rnt OverflowErrorR%RCRGR&(Rts((s/usr/lib64/python2.6/decimal.pyt__int__s    cCs|S(N((R((s/usr/lib64/python2.6/decimal.pytrealscCs tdS(Ni(R(R((s/usr/lib64/python2.6/decimal.pytimagscCs|S(N((R((s/usr/lib64/python2.6/decimal.pyt conjugatescCstt|S(N(tcomplexRd(R((s/usr/lib64/python2.6/decimal.pyt __complex__scCst|iS(sCConverts to a long. Equivalent to long(int(self)) (R[R(R((s/usr/lib64/python2.6/decimal.pyt__long__scCsm|i}|i|i}t||jo7|t||id}t|i||itSt |S(s2Decapitate the payload of a NaN to fit the contextRE( R&R3t_clampRXRZR$R%RCR'R(RRtpayloadtmax_payload_len((s/usr/lib64/python2.6/decimal.pyR( s  cCsZ|io)|io|i|St|Sn|i}|i}|pp|i|g|i}tt |i ||}||i jo!|i t t |id|St|Snt|i|i |i}||jo7|i td|i}|i t|i t|S||j}|o |}n|i |jot|i|i |} | djo#t |id|d}d} n|i|i} t|| | } |i| pd} | djoHtt| d} t| |ijo| d } |d7}q(n||jo|i td|i}nt |i| |}| o|o|i tn|o|i tn| o|i tn|i t|p|i t n|S|o|i tn|idjoI|i |jo9|i t |id|i |} t |i| |St|S(sRound if it is necessary to keep self within prec precision. Rounds and fixes the exponent. Does not raise on a sNaN. Arguments: self - Decimal instance context - context used. REs above EmaxiRii(RDRmR(RRtEtopR4RRRRCRURR$R%RXR&R3R R R t_pick_rounding_functionR2tgetattrRWRGR R (RRRRtexp_maxtnew_exptexp_minR*tself_is_subnormalRktrounding_methodtchangedRR}((s/usr/lib64/python2.6/decimal.pyRsn                  cCs t|i|odSdSdS(s(Also known as round-towards-0, truncate.iiN(t _all_zerosR&(RR3((s/usr/lib64/python2.6/decimal.pyt _round_downscCs|i| S(sRounds away from 0.(R(RR3((s/usr/lib64/python2.6/decimal.pyt _round_upscCs9|i|djodSt|i|odSdSdS(sRounds 5 up (away from 0)t56789iiiN(R&R(RR3((s/usr/lib64/python2.6/decimal.pyt_round_half_ups cCs)t|i|odS|i|SdS(s Round 5 downiN(t _exact_halfR&R(RR3((s/usr/lib64/python2.6/decimal.pyt_round_half_downscCsNt|i|o*|djp|i|ddjodS|i|SdS(s!Round 5 to even, rest to nearest.iit02468iN(RR&R(RR3((s/usr/lib64/python2.6/decimal.pyt_round_half_evens%cCs*|io|i|S|i| SdS(s(Rounds up (not away from 0 if negative.)N(R%R(RR3((s/usr/lib64/python2.6/decimal.pyt_round_ceilings cCs*|ip|i|S|i| SdS(s'Rounds down (not towards 0 if negative)N(R%R(RR3((s/usr/lib64/python2.6/decimal.pyt _round_floors cCs?|o&|i|ddjo|i|S|i| SdS(s)Round down unless digit prec-1 is 0 or 5.it05N(R&R(RR3((s/usr/lib64/python2.6/decimal.pyt _round_05upscCst|dt}|ip |io|djo t}n|idjo|itd|S|idjo|itd|S|idjo |}q|idjo |}q|idjo0|p|itdSt|i |i A}q|idjo0|p|itdSt|i |i A}qnCt |i |i At t |i t |i |i|i}t|dt}|i||S( s:Fused multiply-add. Returns self*other+third with no rounding of the intermediate product self*other. self and other are multiplied together, with no rounding of the result. The third operand is then added to the result, and a single final rounding is performed. RRMRoR#RNsINF * 0 in fmas0 * INF in fmaN(RR'RDR@RRCRURR,R%R$RWRGR&R(RRptthirdRtproduct((s/usr/lib64/python2.6/decimal.pytfmas6       c Cst|dt}t|dt}|d jo t}n|i}|i}|i}|p|p|o|djo|itd|S|djo|itd|S|djo|itd|S|o|i|S|o|i|S|i|S|io|io |ip|itdS|djo|itdS|p|itdS|i |i jo|itdS| o| o|itd S|i o d}n |i }t t|}t|i}t|i} |i|td |i||}x)t| iD]} t|d |}qRWt|| i|}t|t|dS( s!Three argument version of __pow__RiRos@pow() 3rd argument not allowed unless all arguments are integersisApow() 2nd argument cannot be negative when 3rd argument specifiedspow() 3rd argument cannot be 0sSinsufficient precision: pow() 3rd argument must not have more than precision digitssXat least one of pow() 1st argument and 2nd argument must be nonzero ;0**0 is not definedi N(RR'R@RRmRURR(RRxR3t_isevenR%R\RGR]RRRJtxrangeR$RW( RRptmoduloRRqRrt modulo_is_nanR-tbasetexponentti((s/usr/lib64/python2.6/decimal.pyt _power_modulosf                       $cCst|}|i|i}}x*|ddjo|d}|d7}q"Wt|}|i|i}}x*|ddjo|d}|d7}qnW|djo||9}x*|ddjo|d}|d7}qW|djodS|d|} |idjo | } n|io>|idjo.|it|} t| | |d} nd} t ddd| | | S|idjoM|d} | djo|| @|jodSt |d} |djo&|d|}| |} ||}nVd| }t | ||\} }|odSt |||\}}|odS| d |d jodSd | }n(| d jot |d d } t d | |\}}|odSx*|d djo|d }| d8} qW|djo&|d|}| |} ||}nVd| }t | ||\} }|odSt |||\}}|odS| d|djodSd| }ndS|d|jodS| |}t dt ||S|djo|d|d}}n|djo)t t t||| jodSt |}|djo)t t t||| jodS|d| }}x?|d|djo djno|d}|d}qWx?|d |d jo djno|d }|d }qW|djo|djo||jodSt ||\}}|djodSdt | | >}xQtoIt |||d\}}||joPq||d||}qW||jo |djpdS|}n|djo ||dt|jodS||}||9}|d|jodSt |}|ioD|idjo4|it|} t|| |t |} nd} t d|d| || S(shAttempt to compute self**other exactly. Given Decimals self and other and an integer p, attempt to compute an exact result for the power self**other, with p digits of precision. Return None if self**other is not exactly representable in p digits. Assumes that elimination of special cases has already been performed: self and other must both be nonspecial; self must be positive and not numerically equal to 1; other must be nonzero. For efficiency, other._exp should not be too large, so that 10**abs(other._exp) is a feasible calculation.i iiRREiiiiiAi]iiilidN(iiii(R]RGRJR@R-RR%RCRR$t_nbitsRRWRXR\R't _log10_lb(RRptptxtxctxetytyctyeRRtzerost last_digitRty_as_inttten_powRt y_as_integerRhR#txc_bitstremtaRRtstr_xc((s/usr/lib64/python2.6/decimal.pyt _power_exact7s;                     1 1& &     (   !cCs"|d j o|i|||St|}|tjo|S|d jo t}n|i||}|o|S|p |p|itdStSnd}|i djoP|i o|i p d}qn|o|itdS|i }n|p-|i djot |ddSt|Sn|io-|i djo t|St |ddSn|tjo|i o|i djo d}n*||ijo |i}n t|}|i|}|d|ijod|i}|itq9n(|it|itd|i}t |dd| |S|i}|io9|i dj|djjot |ddSt|Snd }t} |i|i} |dj|i djjo=| tt|ijot |d|id}q`nA|i} | tt| jot |d| d}n|d jo]|i||id}|d j o3|djot d|i|i}nt} qn|d jo|i} t|} | i| i }}t|}|i|i }}|i!djo | }nd}xdto\t"||||| |\}}|dd tt|| doPn|d7}qBWt |t||}n| oF|i o8t|i|ijoE|idt|i}t |i |id||i|}n|i#}|i$xt%D]}d|i&||i |ddjo%||jo|d7}|d8}qWt|i|i | |S(s?Normalize- strip trailing 0s, change anything equal to 0 to 0e0RREiiN(R@RRDRsRRnR$R%R4RRRXR&RC(RRR*tdupRtendRJ((s/usr/lib64/python2.6/decimal.pyt normalizes&      % cCst|dt}|djo t}n|djo |i}n|ip |ior|i||}|o|S|ip |io6|io|io t|S|i t dSn|p\|i |i |}|i |i jo/|i t ||jo|i tq*n|S|i|i jo |ijnp|i t dS|p&t|id|i }|i|S|i}||ijo|i t dS||i d|ijo|i t dS|i |i |}|i|ijo|i t dSt|i|ijo|i t dS|o'|i|ijo|i tn|i |i jo/||jo|i tn|i t n|i|}|S( sQuantize self so its exponent is the same as that of exp. Similar to self._rescale(exp._exp) but with error checking. Rsquantize with one INFs)target exponent out of bounds in quantizeREs9exponent of quantize result too large for current contextis7quantize result has too many digits for current contextN(RR'R@RR2RDRsRnRRURRRCR R RR4R$R%RRxR3RXR&tEminR (RRJR2RtwatchexpR*R{((s/usr/lib64/python2.6/decimal.pytquantize sb         *       cCsht|dt}|ip |io2|io |ip|io |iS|i|ijS(s=Return True if self and other have the same exponent; otherwise return False. If either operand is a special value, the following rules are used: * return True if both operands are infinities * return True if both operands are NaNs * otherwise, return False. R(RR'RDRt is_infiniteRC(RRp((s/usr/lib64/python2.6/decimal.pyt same_quantumM s cCs |io t|S|pt|id|S|i|jo&t|i|id|i||St|i|i|}|djo#t|id|d}d}nt||i|}||}|i| pd}|djot t |d}nt|i||S(ssRescale self so that the exponent is exp, either by padding with zeros or by truncating digits, using the given rounding mode. Specials are returned without change. This operation is quiet: it raises no flags, and uses no information from the context. exp = exp to scale to (an integer) rounding = rounding mode REiRi( RDRR$R%RCR&RXRRRWRG(RRJR2Rkt this_functionRR((s/usr/lib64/python2.6/decimal.pyR\ s"       cCs|djotdn|ip| o t|S|i|id||}|i|ijo$|i|id||}n|S(s"Round a nonzero, nonspecial Decimal to a fixed number of significant figures, using the given rounding mode. Infinities, NaNs and zeros are returned unaltered. This operation is quiet: it raises no flags, and uses no information from the context. is'argument should be at least 1 in _roundi(R`RDRRRx(RtplacesR2R*((s/usr/lib64/python2.6/decimal.pyt_round~ s   $cCs|io)|id|}|o|St|S|idjo t|S|pt|iddS|djo t}n|djo |i}n|i d|}||jo|i t n|i t |S(sVRounds to a nearby integer. If no rounding mode is specified, take the rounding mode from the context. This method raises the Rounded and Inexact flags when appropriate. See also: to_integral_value, which does exactly the same as this method except that it doesn't raise Inexact or Rounded. RiREN( RDRsRRCR$R%R@RR2RRUR R (RR2RR*((s/usr/lib64/python2.6/decimal.pytto_integral_exact s$         cCs|djo t}n|djo |i}n|io)|id|}|o|St|S|idjo t|S|id|SdS(s@Rounds to the nearest integer, without raising inexact, rounded.RiN(R@RR2RDRsRRCR(RR2RR*((s/usr/lib64/python2.6/decimal.pyR s       cCs|d jo t}n|ioJ|id|}|o|S|io|idjo t|Sn|p*t|id|id}|i |S|idjo|i t dS|i d}t |}|id?}|id@o(|id}t|id?d}n!|i}t|idd?}||}|djo|d|9}t} n"t|d| \}} | } ||8}d|} x6to.|| } | | joPq| | d?} qW| o| | |j} | o<|djo| d|} n| d| 9} ||7}n | d djo| d7} ntdt| |}|i}|it} |i |}| |_|S( sReturn the square root of self.RiREiissqrt(-x), x > 0i idiN(R@RRDRsRnR%RR$RCRRURR3R]RJRGRXR&R'RRWt _shallow_copyt _set_roundingRR2(RRR*R3RRtctlRRRR#RR2((s/usr/lib64/python2.6/decimal.pytsqrt sb                  cCs$t|dt}|djo t}n|ip |io|i}|i}|p|oa|djo|djo|i|S|djo|djo|i|S|i||Sn|i|}|djo|i |}n|djo |}n|}|i|S(sReturns the larger value. Like max(self, other) except if one is not a number, returns NaN (and signals if one is sNaN). Also rounds. RiiiN( RR'R@RRDRmRRsRt compare_total(RRpRtsntonR)R*((s/usr/lib64/python2.6/decimal.pyR( s&       cCs$t|dt}|djo t}n|ip |io|i}|i}|p|oa|djo|djo|i|S|djo|djo|i|S|i||Sn|i|}|djo|i |}n|djo |}n|}|i|S(sReturns the smaller value. Like min(self, other) except if one is not a number, returns NaN (and signals if one is sNaN). Also rounds. RiiiN( RR'R@RRDRmRRsRR,(RRpRR-R.R)R*((s/usr/lib64/python2.6/decimal.pyRR s&       cCsH|iotS|idjotS|i|i}|dt|jS(s"Returns whether self is an integeriRE(RDRYRCR'R&RX(Rtrest((s/usr/lib64/python2.6/decimal.pyRt s  cCs5| p|idjotS|id|idjS(s:Returns True if self is even. Assumes self is an integer.iiR(RCR'R&(R((s/usr/lib64/python2.6/decimal.pyR} scCs7y|it|idSWntj odSXdS(s$Return the adjusted exponent of selfiiN(RCRXR&Re(R((s/usr/lib64/python2.6/decimal.pyRx scCs|S(sReturns the same Decimal object. As we do not have different encodings for the same number, the received object already is in its canonical form. ((RR((s/usr/lib64/python2.6/decimal.pyt canonical scCsCt|dt}|i||}|o|S|i|d|S(sCompares self to the other operand numerically. It's pretty much like compare(), but all NaNs signal, with signaling NaNs taking precedence over quiet NaNs. RR(RR'RvR(RRpRR*((s/usr/lib64/python2.6/decimal.pytcompare_signal s cCst|dt}|io|i otS|i o|iotS|i}|i}|i}|p|o#||jowt|i|if}t|i|if}||jo|otStSn||jo|otStSntS|oL|djotS|djotS|djotS|djotSq|djotS|djotS|djotS|djotSn||jotS||jotS|i |i jo|otStSn|i |i jo|otStSntS(sCompares self to other using the abstract representations. This is not like the standard compare, which use their numerical value. Note that a total ordering is defined for all possible abstract representations. Rii( RR'R%t _NegativeOneR RmRXR&t_ZeroRC(RRpR-tself_nant other_nantself_keyt other_key((s/usr/lib64/python2.6/decimal.pyR, sf                  cCs7t|dt}|i}|i}|i|S(sCompares self to other using abstract repr., ignoring sign. Like compare_total, but with operand's sign ignored and assumed to be 0. R(RR'RR,(RRpRto((s/usr/lib64/python2.6/decimal.pytcompare_total_mag s  cCstd|i|i|iS(s'Returns a copy with the sign set to 0. i(R$R&RCRD(R((s/usr/lib64/python2.6/decimal.pyR scCsG|iotd|i|i|iStd|i|i|iSdS(s&Returns a copy with the sign inverted.iiN(R%R$R&RCRD(R((s/usr/lib64/python2.6/decimal.pyR s cCst|i|i|i|iS(s$Returns self with the sign of other.(R$R%R&RCRD(RRp((s/usr/lib64/python2.6/decimal.pyt copy_sign sc Cs|d jo t}n|id|}|o|S|idjotS|ptS|idjo t|S|i}|i}|i djoA|t t |i ddjot dd|i d}n|i djoH|t t |i ddjo t dd|id}nD|i djo5|| jo't ddd|dd| }n|i djo5|| djo#t dd|d| d}nt|}|i|i}}|idjo | }nd}x^toVt||||\} } | d d t t | |doPn|d7}qWt dt | | }|i}|it} |i|}| |_|S( sReturns e ** self.RiiiiRRER1ii N(R@RRsRnR3R RR3RxR%RXRWR4R$RR]RGRJR-R't_dexpR'R(RRR2( RRR*RtadjRR)RRRRJR2((s/usr/lib64/python2.6/decimal.pyRJ sL     48 '"#  '  cCstS(sReturn True if self is canonical; otherwise return False. Currently, the encoding of a Decimal instance is always canonical, so this method returns True for any Decimal. (R'(R((s/usr/lib64/python2.6/decimal.pyt is_canonicalN scCs|i S(sReturn True if self is finite; otherwise return False. A Decimal instance is considered finite if it is neither infinite nor a NaN. (RD(R((s/usr/lib64/python2.6/decimal.pyt is_finiteV scCs |idjS(s8Return True if self is infinite; otherwise return False.RN(RC(R((s/usr/lib64/python2.6/decimal.pyR!^ scCs |idjS(s>Return True if self is a qNaN or sNaN; otherwise return False.R#RM(R#RM(RC(R((s/usr/lib64/python2.6/decimal.pyRb scCsD|ip| otS|djo t}n|i|ijS(s?Return True if self is a normal number; otherwise return False.N(RDRYR@RRRx(RR((s/usr/lib64/python2.6/decimal.pyt is_normalf s   cCs |idjS(s;Return True if self is a quiet NaN; otherwise return False.R#(RC(R((s/usr/lib64/python2.6/decimal.pyRun scCs |idjS(s8Return True if self is negative; otherwise return False.i(R%(R((s/usr/lib64/python2.6/decimal.pyt is_signedr scCs |idjS(s?Return True if self is a signaling NaN; otherwise return False.RM(RC(R((s/usr/lib64/python2.6/decimal.pyRtv scCsD|ip| otS|djo t}n|i|ijS(s9Return True if self is subnormal; otherwise return False.N(RDRYR@RRxR(RR((s/usr/lib64/python2.6/decimal.pyt is_subnormalz s   cCs|i o |idjS(s6Return True if self is a zero; otherwise return False.RE(RDR&(R((s/usr/lib64/python2.6/decimal.pytis_zero scCs|it|id}|djott|dddS|djo!ttd|dddSt|}|i|i}}|djo@t|d| }t|}t|t|||jS|ttd| |dS(sCompute a lower bound for the adjusted exponent of self.ln(). In other words, compute r such that self.ln() >= 10**r. Assumes that self is finite and positive and that self != 1. iii iii(RCRXR&RWR]RGRJ(RR<RR)Rtnumtden((s/usr/lib64/python2.6/decimal.pyt _ln_exp_bound s  !   c Cs|d jo t}n|id|}|o|S|ptS|idjotS|tjotS|idjo|i t dSt |}|i |i }}|i}||id}xZtoRt|||}|ddttt||doPn|d7}qWtt |djtt|| }|i}|it} |i|}| |_|S( s/Returns the natural (base e) logarithm of self.Risln of a negative valueiii iiN(R@RRst_NegativeInfinityRnt _InfinityR R3R%RURR]RGRJR3RER't_dlogRXRWR\R$R'R(RRR2( RRR*RR)RRR$RR2((s/usr/lib64/python2.6/decimal.pytln s<      -+  cCs|it|id}|djott|dS|djottd|dSt|}|i|i}}|djoHt|d| }td|}t|t|||jdStd| |}t|||djdS( sCompute a lower bound for the adjusted exponent of self.log10(). In other words, find r such that self.log10() >= 10**r. Assumes that self is finite and positive and that self != 1. iiiii iit231(RCRXR&RWR]RGRJ(RR<RR)RRCRD((s/usr/lib64/python2.6/decimal.pyR  s     #c Cs|d jo t}n|id|}|o|S|ptS|idjotS|idjo|itdS|i ddjoI|i ddt |i djo$t |i t |i d}nt |}|i|i}}|i}||id}xZtoRt|||}|dd t tt||doPn|d 7}qWtt|djtt|| }|i}|it} |i|}| |_|S( s&Returns the base 10 logarithm of self.Rislog10 of a negative valueiRREiii iN(R@RRsRFRnRGR%RURR&RXRRCR]RGRJR3R R't_dlog10RWR\R$R'R(RRR2( RRR*RR)RRR$RR2((s/usr/lib64/python2.6/decimal.pytlog10 s<   9$  -+  cCs|id|}|o|S|djo t}n|iotS|p|itddSt|i}|i |S(sM Returns the exponent of the magnitude of self's MSD. The result is the integer which is the exponent of the magnitude of the most significant digit of self (as though it were truncated to a single digit while maintaining the value of that digit and without limiting the resulting exponent). Rslogb(0)iN( RsR@RRnRGRURRRxR(RRR*((s/usr/lib64/python2.6/decimal.pytlogb" s    cCsO|idjp|idjotSx#|iD]}|djotSq/WtS(sReturn True if self is a logical operand. For being logical, it must be a finite number with a sign of 0, an exponent of 0, and a coefficient whose digits must all be either 0 or 1. it01(R%RCRYR&R'(Rtdig((s/usr/lib64/python2.6/decimal.pyt _islogical@ s    cCs|it|}|djod||}n |djo||i }n|it|}|djod||}n |djo||i }n||fS(NiRE(R3RX(RRtopatopbtdif((s/usr/lib64/python2.6/decimal.pyt _fill_logicalN s    c Cs|djo t}nt|dt}|i p|i o|itS|i||i|i\}}di g}t ||D])\}}|t t |t |@q~}t d|idpddS(s;Applies an 'and' operation between self and other's digits.RRIiREN(R@RRR'RPRURRTR&RbtzipRWRGR$RZ( RRpRRQRRt_[1]RtbR((s/usr/lib64/python2.6/decimal.pyt logical_and[ s  !OcCs=|djo t}n|itdd|id|S(sInvert all its digits.iRN(R@Rt logical_xorR$R3(RR((s/usr/lib64/python2.6/decimal.pytlogical_invertl s  c Cs|djo t}nt|dt}|i p|i o|itS|i||i|i\}}di g}t ||D])\}}|t t |t |Bq~}t d|idpddS(s:Applies an 'or' operation between self and other's digits.RRIiREN(R@RRR'RPRURRTR&RbRURWRGR$RZ( RRpRRQRRRVRRWR((s/usr/lib64/python2.6/decimal.pyt logical_ors s  !Oc Cs|djo t}nt|dt}|i p|i o|itS|i||i|i\}}di g}t ||D])\}}|t t |t |Aq~}t d|idpddS(s;Applies an 'xor' operation between self and other's digits.RRIiREN(R@RRR'RPRURRTR&RbRURWRGR$RZ( RRpRRQRRRVRRWR((s/usr/lib64/python2.6/decimal.pyRY s  !OcCs0t|dt}|djo t}n|ip |io|i}|i}|p|oa|djo|djo|i|S|djo|djo|i|S|i||Sn|ii |i}|djo|i |}n|djo |}n|}|i|S(s8Compares the values numerically with their sign ignored.RiiiN( RR'R@RRDRmRRsRRR,(RRpRR-R.R)R*((s/usr/lib64/python2.6/decimal.pytmax_mag s&       cCs0t|dt}|djo t}n|ip |io|i}|i}|p|oa|djo|djo|i|S|djo|djo|i|S|i||Sn|ii |i}|djo|i |}n|djo |}n|}|i|S(s8Compares the values numerically with their sign ignored.RiiiN( RR'R@RRDRmRRsRRR,(RRpRR-R.R)R*((s/usr/lib64/python2.6/decimal.pytmin_mag s&       cCs|djo t}n|id|}|o|S|idjotS|idjotdd|i|iS|i}|i t |i |i |}||jo|S|i tdd|id|S(s=Returns the largest representable number smaller than itself.RiiiR1RN(R@RRsRnRFR$R3RR:R(Rt_ignore_all_flagsRRR(RRR*tnew_self((s/usr/lib64/python2.6/decimal.pyt next_minus s"      cCs|djo t}n|id|}|o|S|idjotS|idjotdd|i|iS|i}|i t |i |i |}||jo|S|i tdd|id|S(s=Returns the smallest representable number larger than itself.RiiR1iRN(R@RRsRnRGR$R3RR:R(RR^RRR(RRR*R_((s/usr/lib64/python2.6/decimal.pyt next_plus s"      cCsNt|dt}|djo t}n|i||}|o|S|i|}|djo|i|S|djo|i|}n|i|}|i o4|i t d|i |i t |i tng|i|ijoP|i t|i t|i t |i t|p|i tqJn|S(sReturns the number closest to self, in the direction towards other. The result is the closest representable number to self (excluding self) that is in the direction towards other, unless both have the same value. If the two operands are numerically equal, then the result is a copy of self with the sign set to be the same as the sign of other. Riis Infinite result from next_towardN(RR'R@RRsRR:RaR`RnRUR R%R R RxRR R R(RRpRR*t comparison((s/usr/lib64/python2.6/decimal.pyt next_toward s4             cCs|iodS|iodS|i}|djodS|djodS|io|iodSdSn|djo t}n|id |o|iod Sd Sn|iod Sd SdS(sReturns an indication of the class of self. The class is one of the following strings: sNaN NaN -Infinity -Normal -Subnormal -Zero +Zero +Subnormal +Normal +Infinity RoRis +Infinityis -Infinitys-Zeros+ZeroRs -Subnormals +Subnormals-Normals+NormalN(RtRuRnRBR%R@RRA(RRtinf((s/usr/lib64/python2.6/decimal.pyt number_class- s,           cCs tdS(s'Just returns 10, as this is Decimal, :)i (R(R((s/usr/lib64/python2.6/decimal.pytradixW scCsT|djo t}nt|dt}|i||}|o|S|idjo|itS|i t |jo |ijnp|itS|i o t |St |}|i }|it |}|djod||}n|djo|| }n|||| }t|i|idpd|iS(s5Returns a rotated copy of self, value-of-other times.RiREN(R@RRR'RsRCRURR3RGRnRR&RXR$R%RZ(RRpRR*ttorottrotdigttopadtrotated((s/usr/lib64/python2.6/decimal.pytrotate[ s,  +       cCs|djo t}nt|dt}|i||}|o|S|idjo|itSd|i|i }d|i|i }|t |jo |jnp|itS|i o t |St |i|i|it |}|i|}|S(s>Returns self operand after adding the second value to its exp.RiiiN(R@RRR'RsRCRURR4R3RGRnRR$R%R&R(RRpRR*tliminftlimsuptd((s/usr/lib64/python2.6/decimal.pytscaleb| s"  $  %cCsy|djo t}nt|dt}|i||}|o|S|idjo|itS|i t |jo |ijnp|itS|i o t |St |}|i }|it |}|djod||}n|djo|| }n|djo|| }n|d|}||i }t|i|idpd|iS(s5Returns a shifted copy of self, value-of-other times.RiREN(R@RRR'RsRCRURR3RGRnRR&RXR$R%RZ(RRpRR*RgRhRitshifted((s/usr/lib64/python2.6/decimal.pyR s2  +        cCs|it|ffS(N(t __class__RW(R((s/usr/lib64/python2.6/decimal.pyt __reduce__ scCs+t|tjo|S|it|S(N(ttypeRRqRW(R((s/usr/lib64/python2.6/decimal.pyt__copy__ scCs+t|tjo|S|it|S(N(RsRRqRW(Rtmemo((s/usr/lib64/python2.6/decimal.pyt __deepcopy__ sc Csw|djo t}nt|}|iott||S|ddjoddg|i|dR!RR?RuR@RtRARBRERIR RLRMRPRTRXRZR[RYR\R]R`RaRcReRfRkRoRRrRtRvR(((s/usr/lib64/python2.6/decimal.pyRs   !  =      4   V   7 ; !  $    K            \        , T   G  "  c * "    I    K            2  3           . *  !  '   cCs7tit}||_||_||_||_|S(sCreate a decimal instance directly, without any validation, normalization (e.g. removal of leading zeros) or argument conversion. This function is for *internal use only*. (RORPRR%R&RCRD(R-t coefficientRtspecialR((s/usr/lib64/python2.6/decimal.pyR$"s     t_round_iRAcBs)eZdZdZdZdZRS(sContext manager class to support localcontext(). Sets a copy of the supplied context in __enter__() and restores the previous decimal context in __exit__() cCs|i|_dS(N(R:t new_context(RR((s/usr/lib64/python2.6/decimal.pyt__init__LscCs t|_t|i|iS(N(Rt saved_contextRR(R((s/usr/lib64/python2.6/decimal.pyt __enter__Ns  cCst|idS(N(RR(Rtttvttb((s/usr/lib64/python2.6/decimal.pyt__exit__Rs(R R!R"RRR(((s/usr/lib64/python2.6/decimal.pyRAFs  c BseZdZdMdMdMdMdMdMdMddMd ZdZdZdZdZeZ dMdZ dZ d Z d Z dMZd Zd Zd ZddZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"d Z#d!Z$d"Z%d#Z&d$Z'd%Z(d&Z)d'Z*d(Z+d)Z,d*Z-d+Z.d,Z/d-Z0d.Z1d/Z2d0Z3d1Z4d2Z5d3Z6d4Z7d5Z8d6Z9d7Z:d8Z;d9Z<d:Z=d;Z>d<Z?d=Z@dMd>ZAd?ZBd@ZCdAZDdBZEdCZFdDZGdEZHdFZIdGZJdHZKdIZLdJZMdKZNdLZOeOZPRS(NsContains the context for a Decimal instance. Contains: prec - precision (for use in rounding, division, square roots..) rounding - rounding type (how you round) traps - If traps[exception] = 1, then the exception is raised when it is caused. Otherwise, a value is substituted in. flags - When an exception is caused, flags[exception] is set. (Whether or not the trap_enabler is set) Should be reset by user of Decimal instance. Emin - Minimum exponent Emax - Maximum exponent capitals - If 1, 1*10^1 is printed as 1E+1. If 0, printed as 1e1 _clamp - If 1, change exponents if too high (Default 0) ic sy t} Wntj onX|dj o|n| i|_|dj o|n| i|_|dj o|n| i|_|dj o|n| i|_|dj o|n| i|_|dj o|n| i|_| djo g|_ n | |_ djo| i i |_ n=t t p#t fdtD|_ n |_ djot itd|_n=t t p#t fdtD|_n |_dS(Nc3s+x$|]}|t|jfVqWdS(N(RG(t.0R(R(s/usr/lib64/python2.6/decimal.pys s ic3s+x$|]}|t|jfVqWdS(N(RG(RR(R(s/usr/lib64/python2.6/decimal.pys s (Rt NameErrorR@R3R2RR4RRt_ignored_flagsRR:RQtdictRtfromkeysR( RR3R2RRRR4RRRtdc((RRs/usr/lib64/python2.6/decimal.pyRhs.           #  #cCsg}|idt|g}|iiD]!\}}|o||iq1q1~}|iddi|dg}|iiD]!\}}|o||iqq~}|iddi|ddi|dS(sShow the current context.saContext(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)dsflags=[s, t]straps=[t)(RatvarsRtitemsR RbR(RRRVtfRtnamest_[2]R((s/usr/lib64/python2.6/decimal.pyRs >>cCs%x|iD]}d|i|>> ExtendedContext.abs(Decimal('2.1')) Decimal('2.1') >>> ExtendedContext.abs(Decimal('-100')) Decimal('100') >>> ExtendedContext.abs(Decimal('101.5')) Decimal('101.5') >>> ExtendedContext.abs(Decimal('-101.5')) Decimal('101.5') R(R(RR((s/usr/lib64/python2.6/decimal.pyR\scCs|i|d|S(sReturn the sum of the two operands. >>> ExtendedContext.add(Decimal('12'), Decimal('7.00')) Decimal('19.00') >>> ExtendedContext.add(Decimal('1E+2'), Decimal('1.01E+4')) Decimal('1.02E+4') R(R(RRRW((s/usr/lib64/python2.6/decimal.pytaddscCst|i|S(N(RWR(RR((s/usr/lib64/python2.6/decimal.pyt_apply"scCs|id|S(sReturns the same Decimal object. As we do not have different encodings for the same number, the received object already is in its canonical form. >>> ExtendedContext.canonical(Decimal('2.50')) Decimal('2.50') R(R0(RR((s/usr/lib64/python2.6/decimal.pyR0%s cCs|i|d|S(sCompares values numerically. If the signs of the operands differ, a value representing each operand ('-1' if the operand is less than zero, '0' if the operand is zero or negative zero, or '1' if the operand is greater than zero) is used in place of that operand for the comparison instead of the actual operand. The comparison is then effected by subtracting the second operand from the first and then returning a value according to the result of the subtraction: '-1' if the result is less than zero, '0' if the result is zero or negative zero, or '1' if the result is greater than zero. >>> ExtendedContext.compare(Decimal('2.1'), Decimal('3')) Decimal('-1') >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.1')) Decimal('0') >>> ExtendedContext.compare(Decimal('2.1'), Decimal('2.10')) Decimal('0') >>> ExtendedContext.compare(Decimal('3'), Decimal('2.1')) Decimal('1') >>> ExtendedContext.compare(Decimal('2.1'), Decimal('-3')) Decimal('1') >>> ExtendedContext.compare(Decimal('-3'), Decimal('2.1')) Decimal('-1') R(R(RRRW((s/usr/lib64/python2.6/decimal.pyR0scCs|i|d|S(sTCompares the values of the two operands numerically. It's pretty much like compare(), but all NaNs signal, with signaling NaNs taking precedence over quiet NaNs. >>> c = ExtendedContext >>> c.compare_signal(Decimal('2.1'), Decimal('3')) Decimal('-1') >>> c.compare_signal(Decimal('2.1'), Decimal('2.1')) Decimal('0') >>> c.flags[InvalidOperation] = 0 >>> print c.flags[InvalidOperation] 0 >>> c.compare_signal(Decimal('NaN'), Decimal('2.1')) Decimal('NaN') >>> print c.flags[InvalidOperation] 1 >>> c.flags[InvalidOperation] = 0 >>> print c.flags[InvalidOperation] 0 >>> c.compare_signal(Decimal('sNaN'), Decimal('2.1')) Decimal('NaN') >>> print c.flags[InvalidOperation] 1 R(R1(RRRW((s/usr/lib64/python2.6/decimal.pyR1MscCs |i|S(sGCompares two operands using their abstract representation. This is not like the standard compare, which use their numerical value. Note that a total ordering is defined for all possible abstract representations. >>> ExtendedContext.compare_total(Decimal('12.73'), Decimal('127.9')) Decimal('-1') >>> ExtendedContext.compare_total(Decimal('-127'), Decimal('12')) Decimal('-1') >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.3')) Decimal('-1') >>> ExtendedContext.compare_total(Decimal('12.30'), Decimal('12.30')) Decimal('0') >>> ExtendedContext.compare_total(Decimal('12.3'), Decimal('12.300')) Decimal('1') >>> ExtendedContext.compare_total(Decimal('12.3'), Decimal('NaN')) Decimal('-1') (R,(RRRW((s/usr/lib64/python2.6/decimal.pyR,iscCs |i|S(sCompares two operands using their abstract representation ignoring sign. Like compare_total, but with operand's sign ignored and assumed to be 0. (R9(RRRW((s/usr/lib64/python2.6/decimal.pyR9scCs |iS(sReturns a copy of the operand with the sign set to 0. >>> ExtendedContext.copy_abs(Decimal('2.1')) Decimal('2.1') >>> ExtendedContext.copy_abs(Decimal('-100')) Decimal('100') (R(RR((s/usr/lib64/python2.6/decimal.pyRscCs t|S(sReturns a copy of the decimal objet. >>> ExtendedContext.copy_decimal(Decimal('2.1')) Decimal('2.1') >>> ExtendedContext.copy_decimal(Decimal('-1.00')) Decimal('-1.00') (R(RR((s/usr/lib64/python2.6/decimal.pyt copy_decimalscCs |iS(sReturns a copy of the operand with the sign inverted. >>> ExtendedContext.copy_negate(Decimal('101.5')) Decimal('-101.5') >>> ExtendedContext.copy_negate(Decimal('-101.5')) Decimal('101.5') (R(RR((s/usr/lib64/python2.6/decimal.pyRscCs |i|S(s>Copies the second operand's sign to the first one. In detail, it returns a copy of the first operand with the sign equal to the sign of the second operand. >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('7.33')) Decimal('1.50') >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('7.33')) Decimal('1.50') >>> ExtendedContext.copy_sign(Decimal( '1.50'), Decimal('-7.33')) Decimal('-1.50') >>> ExtendedContext.copy_sign(Decimal('-1.50'), Decimal('-7.33')) Decimal('-1.50') (R:(RRRW((s/usr/lib64/python2.6/decimal.pyR:scCs|i|d|S(sDecimal division in a specified context. >>> ExtendedContext.divide(Decimal('1'), Decimal('3')) Decimal('0.333333333') >>> ExtendedContext.divide(Decimal('2'), Decimal('3')) Decimal('0.666666667') >>> ExtendedContext.divide(Decimal('5'), Decimal('2')) Decimal('2.5') >>> ExtendedContext.divide(Decimal('1'), Decimal('10')) Decimal('0.1') >>> ExtendedContext.divide(Decimal('12'), Decimal('12')) Decimal('1') >>> ExtendedContext.divide(Decimal('8.00'), Decimal('2')) Decimal('4.00') >>> ExtendedContext.divide(Decimal('2.400'), Decimal('2.0')) Decimal('1.20') >>> ExtendedContext.divide(Decimal('1000'), Decimal('100')) Decimal('10') >>> ExtendedContext.divide(Decimal('1000'), Decimal('1')) Decimal('1000') >>> ExtendedContext.divide(Decimal('2.40E+6'), Decimal('2')) Decimal('1.20E+6') R(R(RRRW((s/usr/lib64/python2.6/decimal.pytdividescCs|i|d|S(sTDivides two numbers and returns the integer part of the result. >>> ExtendedContext.divide_int(Decimal('2'), Decimal('3')) Decimal('0') >>> ExtendedContext.divide_int(Decimal('10'), Decimal('3')) Decimal('3') >>> ExtendedContext.divide_int(Decimal('1'), Decimal('0.3')) Decimal('3') R(R(RRRW((s/usr/lib64/python2.6/decimal.pyt divide_ints cCs|i|d|S(sReturn (a // b, a % b) >>> ExtendedContext.divmod(Decimal(8), Decimal(3)) (Decimal('2'), Decimal('2')) >>> ExtendedContext.divmod(Decimal(8), Decimal(4)) (Decimal('2'), Decimal('0')) R(R(RRRW((s/usr/lib64/python2.6/decimal.pyRscCs|id|S(sReturns e ** a. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.exp(Decimal('-Infinity')) Decimal('0') >>> c.exp(Decimal('-1')) Decimal('0.367879441') >>> c.exp(Decimal('0')) Decimal('1') >>> c.exp(Decimal('1')) Decimal('2.71828183') >>> c.exp(Decimal('0.693147181')) Decimal('2.00000000') >>> c.exp(Decimal('+Infinity')) Decimal('Infinity') R(RJ(RR((s/usr/lib64/python2.6/decimal.pyRJscCs|i||d|S(s@Returns a multiplied by b, plus c. The first two operands are multiplied together, using multiply, the third operand is then added to the result of that multiplication, using add, all with only one final rounding. >>> ExtendedContext.fma(Decimal('3'), Decimal('5'), Decimal('7')) Decimal('22') >>> ExtendedContext.fma(Decimal('3'), Decimal('-5'), Decimal('7')) Decimal('-8') >>> ExtendedContext.fma(Decimal('888565290'), Decimal('1557.96930'), Decimal('-86087.7578')) Decimal('1.38435736E+12') R(R(RRRWR)((s/usr/lib64/python2.6/decimal.pyRscCs |iS(sReturn True if the operand is canonical; otherwise return False. Currently, the encoding of a Decimal instance is always canonical, so this method returns True for any Decimal. >>> ExtendedContext.is_canonical(Decimal('2.50')) True (R=(RR((s/usr/lib64/python2.6/decimal.pyR= s cCs |iS(sReturn True if the operand is finite; otherwise return False. A Decimal instance is considered finite if it is neither infinite nor a NaN. >>> ExtendedContext.is_finite(Decimal('2.50')) True >>> ExtendedContext.is_finite(Decimal('-0.3')) True >>> ExtendedContext.is_finite(Decimal('0')) True >>> ExtendedContext.is_finite(Decimal('Inf')) False >>> ExtendedContext.is_finite(Decimal('NaN')) False (R>(RR((s/usr/lib64/python2.6/decimal.pyR>scCs |iS(sReturn True if the operand is infinite; otherwise return False. >>> ExtendedContext.is_infinite(Decimal('2.50')) False >>> ExtendedContext.is_infinite(Decimal('-Inf')) True >>> ExtendedContext.is_infinite(Decimal('NaN')) False (R!(RR((s/usr/lib64/python2.6/decimal.pyR!(s cCs |iS(sReturn True if the operand is a qNaN or sNaN; otherwise return False. >>> ExtendedContext.is_nan(Decimal('2.50')) False >>> ExtendedContext.is_nan(Decimal('NaN')) True >>> ExtendedContext.is_nan(Decimal('-sNaN')) True (R(RR((s/usr/lib64/python2.6/decimal.pyR4s cCs|id|S(sReturn True if the operand is a normal number; otherwise return False. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.is_normal(Decimal('2.50')) True >>> c.is_normal(Decimal('0.1E-999')) False >>> c.is_normal(Decimal('0.00')) False >>> c.is_normal(Decimal('-Inf')) False >>> c.is_normal(Decimal('NaN')) False R(R?(RR((s/usr/lib64/python2.6/decimal.pyR?AscCs |iS(sReturn True if the operand is a quiet NaN; otherwise return False. >>> ExtendedContext.is_qnan(Decimal('2.50')) False >>> ExtendedContext.is_qnan(Decimal('NaN')) True >>> ExtendedContext.is_qnan(Decimal('sNaN')) False (Ru(RR((s/usr/lib64/python2.6/decimal.pyRuUs cCs |iS(sReturn True if the operand is negative; otherwise return False. >>> ExtendedContext.is_signed(Decimal('2.50')) False >>> ExtendedContext.is_signed(Decimal('-12')) True >>> ExtendedContext.is_signed(Decimal('-0')) True (R@(RR((s/usr/lib64/python2.6/decimal.pyR@as cCs |iS(sReturn True if the operand is a signaling NaN; otherwise return False. >>> ExtendedContext.is_snan(Decimal('2.50')) False >>> ExtendedContext.is_snan(Decimal('NaN')) False >>> ExtendedContext.is_snan(Decimal('sNaN')) True (Rt(RR((s/usr/lib64/python2.6/decimal.pyRtms cCs|id|S(sReturn True if the operand is subnormal; otherwise return False. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.is_subnormal(Decimal('2.50')) False >>> c.is_subnormal(Decimal('0.1E-999')) True >>> c.is_subnormal(Decimal('0.00')) False >>> c.is_subnormal(Decimal('-Inf')) False >>> c.is_subnormal(Decimal('NaN')) False R(RA(RR((s/usr/lib64/python2.6/decimal.pyRAzscCs |iS(s Return True if the operand is a zero; otherwise return False. >>> ExtendedContext.is_zero(Decimal('0')) True >>> ExtendedContext.is_zero(Decimal('2.50')) False >>> ExtendedContext.is_zero(Decimal('-0E+2')) True (RB(RR((s/usr/lib64/python2.6/decimal.pyRBs cCs|id|S(sReturns the natural (base e) logarithm of the operand. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.ln(Decimal('0')) Decimal('-Infinity') >>> c.ln(Decimal('1.000')) Decimal('0') >>> c.ln(Decimal('2.71828183')) Decimal('1.00000000') >>> c.ln(Decimal('10')) Decimal('2.30258509') >>> c.ln(Decimal('+Infinity')) Decimal('Infinity') R(RI(RR((s/usr/lib64/python2.6/decimal.pyRIscCs|id|S(sGReturns the base 10 logarithm of the operand. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.log10(Decimal('0')) Decimal('-Infinity') >>> c.log10(Decimal('0.001')) Decimal('-3') >>> c.log10(Decimal('1.000')) Decimal('0') >>> c.log10(Decimal('2')) Decimal('0.301029996') >>> c.log10(Decimal('10')) Decimal('1') >>> c.log10(Decimal('70')) Decimal('1.84509804') >>> c.log10(Decimal('+Infinity')) Decimal('Infinity') R(RL(RR((s/usr/lib64/python2.6/decimal.pyRLscCs|id|S(s Returns the exponent of the magnitude of the operand's MSD. The result is the integer which is the exponent of the magnitude of the most significant digit of the operand (as though the operand were truncated to a single digit while maintaining the value of that digit and without limiting the resulting exponent). >>> ExtendedContext.logb(Decimal('250')) Decimal('2') >>> ExtendedContext.logb(Decimal('2.50')) Decimal('0') >>> ExtendedContext.logb(Decimal('0.03')) Decimal('-2') >>> ExtendedContext.logb(Decimal('0')) Decimal('-Infinity') R(RM(RR((s/usr/lib64/python2.6/decimal.pyRMscCs|i|d|S(sApplies the logical operation 'and' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_and(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_and(Decimal('0'), Decimal('1')) Decimal('0') >>> ExtendedContext.logical_and(Decimal('1'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_and(Decimal('1'), Decimal('1')) Decimal('1') >>> ExtendedContext.logical_and(Decimal('1100'), Decimal('1010')) Decimal('1000') >>> ExtendedContext.logical_and(Decimal('1111'), Decimal('10')) Decimal('10') R(RX(RRRW((s/usr/lib64/python2.6/decimal.pyRXscCs|id|S(sInvert all the digits in the operand. The operand must be a logical number. >>> ExtendedContext.logical_invert(Decimal('0')) Decimal('111111111') >>> ExtendedContext.logical_invert(Decimal('1')) Decimal('111111110') >>> ExtendedContext.logical_invert(Decimal('111111111')) Decimal('0') >>> ExtendedContext.logical_invert(Decimal('101010101')) Decimal('10101010') R(RZ(RR((s/usr/lib64/python2.6/decimal.pyRZscCs|i|d|S(sApplies the logical operation 'or' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_or(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_or(Decimal('0'), Decimal('1')) Decimal('1') >>> ExtendedContext.logical_or(Decimal('1'), Decimal('0')) Decimal('1') >>> ExtendedContext.logical_or(Decimal('1'), Decimal('1')) Decimal('1') >>> ExtendedContext.logical_or(Decimal('1100'), Decimal('1010')) Decimal('1110') >>> ExtendedContext.logical_or(Decimal('1110'), Decimal('10')) Decimal('1110') R(R[(RRRW((s/usr/lib64/python2.6/decimal.pyR[scCs|i|d|S(sApplies the logical operation 'xor' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1')) Decimal('1') >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('0')) Decimal('1') >>> ExtendedContext.logical_xor(Decimal('1'), Decimal('1')) Decimal('0') >>> ExtendedContext.logical_xor(Decimal('1100'), Decimal('1010')) Decimal('110') >>> ExtendedContext.logical_xor(Decimal('1111'), Decimal('10')) Decimal('1101') R(RY(RRRW((s/usr/lib64/python2.6/decimal.pyRYscCs|i|d|S(smax compares two values numerically and returns the maximum. If either operand is a NaN then the general rules apply. Otherwise, the operands are compared as though by the compare operation. If they are numerically equal then the left-hand operand is chosen as the result. Otherwise the maximum (closer to positive infinity) of the two operands is chosen as the result. >>> ExtendedContext.max(Decimal('3'), Decimal('2')) Decimal('3') >>> ExtendedContext.max(Decimal('-10'), Decimal('3')) Decimal('3') >>> ExtendedContext.max(Decimal('1.0'), Decimal('1')) Decimal('1') >>> ExtendedContext.max(Decimal('7'), Decimal('NaN')) Decimal('7') R(R(RRRW((s/usr/lib64/python2.6/decimal.pyR"scCs|i|d|S(s8Compares the values numerically with their sign ignored.R(R\(RRRW((s/usr/lib64/python2.6/decimal.pyR\6scCs|i|d|S(smin compares two values numerically and returns the minimum. If either operand is a NaN then the general rules apply. Otherwise, the operands are compared as though by the compare operation. If they are numerically equal then the left-hand operand is chosen as the result. Otherwise the minimum (closer to negative infinity) of the two operands is chosen as the result. >>> ExtendedContext.min(Decimal('3'), Decimal('2')) Decimal('2') >>> ExtendedContext.min(Decimal('-10'), Decimal('3')) Decimal('-10') >>> ExtendedContext.min(Decimal('1.0'), Decimal('1')) Decimal('1.0') >>> ExtendedContext.min(Decimal('7'), Decimal('NaN')) Decimal('7') R(R(RRRW((s/usr/lib64/python2.6/decimal.pyR:scCs|i|d|S(s8Compares the values numerically with their sign ignored.R(R](RRRW((s/usr/lib64/python2.6/decimal.pyR]NscCs|id|S(sMinus corresponds to unary prefix minus in Python. The operation is evaluated using the same rules as subtract; the operation minus(a) is calculated as subtract('0', a) where the '0' has the same exponent as the operand. >>> ExtendedContext.minus(Decimal('1.3')) Decimal('-1.3') >>> ExtendedContext.minus(Decimal('-1.3')) Decimal('1.3') R(R(RR((s/usr/lib64/python2.6/decimal.pytminusRs cCs|i|d|S(s multiply multiplies two operands. If either operand is a special value then the general rules apply. Otherwise, the operands are multiplied together ('long multiplication'), resulting in a number which may be as long as the sum of the lengths of the two operands. >>> ExtendedContext.multiply(Decimal('1.20'), Decimal('3')) Decimal('3.60') >>> ExtendedContext.multiply(Decimal('7'), Decimal('3')) Decimal('21') >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('0.8')) Decimal('0.72') >>> ExtendedContext.multiply(Decimal('0.9'), Decimal('-0')) Decimal('-0.0') >>> ExtendedContext.multiply(Decimal('654321'), Decimal('654321')) Decimal('4.28135971E+11') R(R(RRRW((s/usr/lib64/python2.6/decimal.pytmultiply`scCs|id|S(sReturns the largest representable number smaller than a. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> ExtendedContext.next_minus(Decimal('1')) Decimal('0.999999999') >>> c.next_minus(Decimal('1E-1007')) Decimal('0E-1007') >>> ExtendedContext.next_minus(Decimal('-1.00000003')) Decimal('-1.00000004') >>> c.next_minus(Decimal('Infinity')) Decimal('9.99999999E+999') R(R`(RR((s/usr/lib64/python2.6/decimal.pyR`uscCs|id|S(sReturns the smallest representable number larger than a. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> ExtendedContext.next_plus(Decimal('1')) Decimal('1.00000001') >>> c.next_plus(Decimal('-1E-1007')) Decimal('-0E-1007') >>> ExtendedContext.next_plus(Decimal('-1.00000003')) Decimal('-1.00000002') >>> c.next_plus(Decimal('-Infinity')) Decimal('-9.99999999E+999') R(Ra(RR((s/usr/lib64/python2.6/decimal.pyRascCs|i|d|S(sReturns the number closest to a, in direction towards b. The result is the closest representable number from the first operand (but not the first operand) that is in the direction towards the second operand, unless the operands have the same value. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.next_toward(Decimal('1'), Decimal('2')) Decimal('1.00000001') >>> c.next_toward(Decimal('-1E-1007'), Decimal('1')) Decimal('-0E-1007') >>> c.next_toward(Decimal('-1.00000003'), Decimal('0')) Decimal('-1.00000002') >>> c.next_toward(Decimal('1'), Decimal('0')) Decimal('0.999999999') >>> c.next_toward(Decimal('1E-1007'), Decimal('-100')) Decimal('0E-1007') >>> c.next_toward(Decimal('-1.00000003'), Decimal('-10')) Decimal('-1.00000004') >>> c.next_toward(Decimal('0.00'), Decimal('-0.0000')) Decimal('-0.00') R(Rc(RRRW((s/usr/lib64/python2.6/decimal.pyRcscCs|id|S(sunormalize reduces an operand to its simplest form. Essentially a plus operation with all trailing zeros removed from the result. >>> ExtendedContext.normalize(Decimal('2.1')) Decimal('2.1') >>> ExtendedContext.normalize(Decimal('-2.0')) Decimal('-2') >>> ExtendedContext.normalize(Decimal('1.200')) Decimal('1.2') >>> ExtendedContext.normalize(Decimal('-120')) Decimal('-1.2E+2') >>> ExtendedContext.normalize(Decimal('120.00')) Decimal('1.2E+2') >>> ExtendedContext.normalize(Decimal('0.00')) Decimal('0') R(R(RR((s/usr/lib64/python2.6/decimal.pyRscCs|id|S(sReturns an indication of the class of the operand. The class is one of the following strings: -sNaN -NaN -Infinity -Normal -Subnormal -Zero +Zero +Subnormal +Normal +Infinity >>> c = Context(ExtendedContext) >>> c.Emin = -999 >>> c.Emax = 999 >>> c.number_class(Decimal('Infinity')) '+Infinity' >>> c.number_class(Decimal('1E-10')) '+Normal' >>> c.number_class(Decimal('2.50')) '+Normal' >>> c.number_class(Decimal('0.1E-999')) '+Subnormal' >>> c.number_class(Decimal('0')) '+Zero' >>> c.number_class(Decimal('-0')) '-Zero' >>> c.number_class(Decimal('-0.1E-999')) '-Subnormal' >>> c.number_class(Decimal('-1E-10')) '-Normal' >>> c.number_class(Decimal('-2.50')) '-Normal' >>> c.number_class(Decimal('-Infinity')) '-Infinity' >>> c.number_class(Decimal('NaN')) 'NaN' >>> c.number_class(Decimal('-NaN')) 'NaN' >>> c.number_class(Decimal('sNaN')) 'sNaN' R(Re(RR((s/usr/lib64/python2.6/decimal.pyRes-cCs|id|S(sPlus corresponds to unary prefix plus in Python. The operation is evaluated using the same rules as add; the operation plus(a) is calculated as add('0', a) where the '0' has the same exponent as the operand. >>> ExtendedContext.plus(Decimal('1.3')) Decimal('1.3') >>> ExtendedContext.plus(Decimal('-1.3')) Decimal('-1.3') R(R(RR((s/usr/lib64/python2.6/decimal.pytpluss cCs|i||d|S(s1 Raises a to the power of b, to modulo if given. With two arguments, compute a**b. If a is negative then b must be integral. The result will be inexact unless b is integral and the result is finite and can be expressed exactly in 'precision' digits. With three arguments, compute (a**b) % modulo. For the three argument form, the following restrictions on the arguments hold: - all three arguments must be integral - b must be nonnegative - at least one of a or b must be nonzero - modulo must be nonzero and have at most 'precision' digits The result of pow(a, b, modulo) is identical to the result that would be obtained by computing (a**b) % modulo with unbounded precision, but is computed more efficiently. It is always exact. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.power(Decimal('2'), Decimal('3')) Decimal('8') >>> c.power(Decimal('-2'), Decimal('3')) Decimal('-8') >>> c.power(Decimal('2'), Decimal('-3')) Decimal('0.125') >>> c.power(Decimal('1.7'), Decimal('8')) Decimal('69.7575744') >>> c.power(Decimal('10'), Decimal('0.301029996')) Decimal('2.00000000') >>> c.power(Decimal('Infinity'), Decimal('-1')) Decimal('0') >>> c.power(Decimal('Infinity'), Decimal('0')) Decimal('1') >>> c.power(Decimal('Infinity'), Decimal('1')) Decimal('Infinity') >>> c.power(Decimal('-Infinity'), Decimal('-1')) Decimal('-0') >>> c.power(Decimal('-Infinity'), Decimal('0')) Decimal('1') >>> c.power(Decimal('-Infinity'), Decimal('1')) Decimal('-Infinity') >>> c.power(Decimal('-Infinity'), Decimal('2')) Decimal('Infinity') >>> c.power(Decimal('0'), Decimal('0')) Decimal('NaN') >>> c.power(Decimal('3'), Decimal('7'), Decimal('16')) Decimal('11') >>> c.power(Decimal('-3'), Decimal('7'), Decimal('16')) Decimal('-11') >>> c.power(Decimal('-3'), Decimal('8'), Decimal('16')) Decimal('1') >>> c.power(Decimal('3'), Decimal('7'), Decimal('-16')) Decimal('11') >>> c.power(Decimal('23E12345'), Decimal('67E189'), Decimal('123456789')) Decimal('11729830') >>> c.power(Decimal('-0'), Decimal('17'), Decimal('1729')) Decimal('-0') >>> c.power(Decimal('-23'), Decimal('0'), Decimal('65537')) Decimal('1') R(R(RRRWR((s/usr/lib64/python2.6/decimal.pytpowersCcCs|i|d|S(sC Returns a value equal to 'a' (rounded), having the exponent of 'b'. The coefficient of the result is derived from that of the left-hand operand. It may be rounded using the current rounding setting (if the exponent is being increased), multiplied by a positive power of ten (if the exponent is being decreased), or is unchanged (if the exponent is already equal to that of the right-hand operand). Unlike other operations, if the length of the coefficient after the quantize operation would be greater than precision then an Invalid operation condition is raised. This guarantees that, unless there is an error condition, the exponent of the result of a quantize is always equal to that of the right-hand operand. Also unlike other operations, quantize will never raise Underflow, even if the result is subnormal and inexact. >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.001')) Decimal('2.170') >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.01')) Decimal('2.17') >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('0.1')) Decimal('2.2') >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+0')) Decimal('2') >>> ExtendedContext.quantize(Decimal('2.17'), Decimal('1e+1')) Decimal('0E+1') >>> ExtendedContext.quantize(Decimal('-Inf'), Decimal('Infinity')) Decimal('-Infinity') >>> ExtendedContext.quantize(Decimal('2'), Decimal('Infinity')) Decimal('NaN') >>> ExtendedContext.quantize(Decimal('-0.1'), Decimal('1')) Decimal('-0') >>> ExtendedContext.quantize(Decimal('-0'), Decimal('1e+5')) Decimal('-0E+5') >>> ExtendedContext.quantize(Decimal('+35236450.6'), Decimal('1e-2')) Decimal('NaN') >>> ExtendedContext.quantize(Decimal('-35236450.6'), Decimal('1e-2')) Decimal('NaN') >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-1')) Decimal('217.0') >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e-0')) Decimal('217') >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+1')) Decimal('2.2E+2') >>> ExtendedContext.quantize(Decimal('217'), Decimal('1e+2')) Decimal('2E+2') R(R (RRRW((s/usr/lib64/python2.6/decimal.pyR Js1cCs tdS(skJust returns 10, as this is Decimal, :) >>> ExtendedContext.radix() Decimal('10') i (R(R((s/usr/lib64/python2.6/decimal.pyRf}scCs|i|d|S(s>Returns the remainder from integer division. The result is the residue of the dividend after the operation of calculating integer division as described for divide-integer, rounded to precision digits if necessary. The sign of the result, if non-zero, is the same as that of the original dividend. This operation will fail under the same conditions as integer division (that is, if integer division on the same two operands would fail, the remainder cannot be calculated). >>> ExtendedContext.remainder(Decimal('2.1'), Decimal('3')) Decimal('2.1') >>> ExtendedContext.remainder(Decimal('10'), Decimal('3')) Decimal('1') >>> ExtendedContext.remainder(Decimal('-10'), Decimal('3')) Decimal('-1') >>> ExtendedContext.remainder(Decimal('10.2'), Decimal('1')) Decimal('0.2') >>> ExtendedContext.remainder(Decimal('10'), Decimal('0.3')) Decimal('0.1') >>> ExtendedContext.remainder(Decimal('3.6'), Decimal('1.3')) Decimal('1.0') R(R(RRRW((s/usr/lib64/python2.6/decimal.pyRscCs|i|d|S(s`Returns to be "a - b * n", where n is the integer nearest the exact value of "x / b" (if two integers are equally near then the even one is chosen). If the result is equal to 0 then its sign will be the sign of a. This operation will fail under the same conditions as integer division (that is, if integer division on the same two operands would fail, the remainder cannot be calculated). >>> ExtendedContext.remainder_near(Decimal('2.1'), Decimal('3')) Decimal('-0.9') >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('6')) Decimal('-2') >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('3')) Decimal('1') >>> ExtendedContext.remainder_near(Decimal('-10'), Decimal('3')) Decimal('-1') >>> ExtendedContext.remainder_near(Decimal('10.2'), Decimal('1')) Decimal('0.2') >>> ExtendedContext.remainder_near(Decimal('10'), Decimal('0.3')) Decimal('0.1') >>> ExtendedContext.remainder_near(Decimal('3.6'), Decimal('1.3')) Decimal('-0.3') R(R(RRRW((s/usr/lib64/python2.6/decimal.pyRscCs|i|d|S(s[Returns a rotated copy of a, b times. The coefficient of the result is a rotated copy of the digits in the coefficient of the first operand. The number of places of rotation is taken from the absolute value of the second operand, with the rotation being to the left if the second operand is positive or to the right otherwise. >>> ExtendedContext.rotate(Decimal('34'), Decimal('8')) Decimal('400000003') >>> ExtendedContext.rotate(Decimal('12'), Decimal('9')) Decimal('12') >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('-2')) Decimal('891234567') >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('0')) Decimal('123456789') >>> ExtendedContext.rotate(Decimal('123456789'), Decimal('+2')) Decimal('345678912') R(Rk(RRRW((s/usr/lib64/python2.6/decimal.pyRkscCs |i|S(sReturns True if the two operands have the same exponent. The result is never affected by either the sign or the coefficient of either operand. >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.001')) False >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('0.01')) True >>> ExtendedContext.same_quantum(Decimal('2.17'), Decimal('1')) False >>> ExtendedContext.same_quantum(Decimal('Inf'), Decimal('-Inf')) True (R"(RRRW((s/usr/lib64/python2.6/decimal.pyR"scCs|i|d|S(s^Returns the first operand after adding the second value its exp. >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('-2')) Decimal('0.0750') >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('0')) Decimal('7.50') >>> ExtendedContext.scaleb(Decimal('7.50'), Decimal('3')) Decimal('7.50E+3') R(Ro(RRRW((s/usr/lib64/python2.6/decimal.pyRos cCs|i|d|S(sReturns a shifted copy of a, b times. The coefficient of the result is a shifted copy of the digits in the coefficient of the first operand. The number of places to shift is taken from the absolute value of the second operand, with the shift being to the left if the second operand is positive or to the right otherwise. Digits shifted into the coefficient are zeros. >>> ExtendedContext.shift(Decimal('34'), Decimal('8')) Decimal('400000000') >>> ExtendedContext.shift(Decimal('12'), Decimal('9')) Decimal('0') >>> ExtendedContext.shift(Decimal('123456789'), Decimal('-2')) Decimal('1234567') >>> ExtendedContext.shift(Decimal('123456789'), Decimal('0')) Decimal('123456789') >>> ExtendedContext.shift(Decimal('123456789'), Decimal('+2')) Decimal('345678900') R(R(RRRW((s/usr/lib64/python2.6/decimal.pyRscCs|id|S(sdSquare root of a non-negative number to context precision. If the result must be inexact, it is rounded using the round-half-even algorithm. >>> ExtendedContext.sqrt(Decimal('0')) Decimal('0') >>> ExtendedContext.sqrt(Decimal('-0')) Decimal('-0') >>> ExtendedContext.sqrt(Decimal('0.39')) Decimal('0.624499800') >>> ExtendedContext.sqrt(Decimal('100')) Decimal('10') >>> ExtendedContext.sqrt(Decimal('1')) Decimal('1') >>> ExtendedContext.sqrt(Decimal('1.0')) Decimal('1.0') >>> ExtendedContext.sqrt(Decimal('1.00')) Decimal('1.0') >>> ExtendedContext.sqrt(Decimal('7')) Decimal('2.64575131') >>> ExtendedContext.sqrt(Decimal('10')) Decimal('3.16227766') >>> ExtendedContext.prec 9 R(R+(RR((s/usr/lib64/python2.6/decimal.pyR+scCs|i|d|S(sTReturn the difference between the two operands. >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.07')) Decimal('0.23') >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('1.30')) Decimal('0.00') >>> ExtendedContext.subtract(Decimal('1.3'), Decimal('2.07')) Decimal('-0.77') R(R(RRRW((s/usr/lib64/python2.6/decimal.pytsubtract"s cCs|id|S(syConverts a number to a string, using scientific notation. The operation is not affected by the context. R(R(RR((s/usr/lib64/python2.6/decimal.pyR.scCs|id|S(syConverts a number to a string, using scientific notation. The operation is not affected by the context. R(R(RR((s/usr/lib64/python2.6/decimal.pyt to_sci_string5scCs|id|S(skRounds to an integer. When the operand has a negative exponent, the result is the same as using the quantize() operation using the given operand as the left-hand-operand, 1E+0 as the right-hand-operand, and the precision of the operand as the precision setting; Inexact and Rounded flags are allowed in this operation. The rounding mode is taken from the context. >>> ExtendedContext.to_integral_exact(Decimal('2.1')) Decimal('2') >>> ExtendedContext.to_integral_exact(Decimal('100')) Decimal('100') >>> ExtendedContext.to_integral_exact(Decimal('100.0')) Decimal('100') >>> ExtendedContext.to_integral_exact(Decimal('101.5')) Decimal('102') >>> ExtendedContext.to_integral_exact(Decimal('-101.5')) Decimal('-102') >>> ExtendedContext.to_integral_exact(Decimal('10E+5')) Decimal('1.0E+6') >>> ExtendedContext.to_integral_exact(Decimal('7.89E+77')) Decimal('7.89E+77') >>> ExtendedContext.to_integral_exact(Decimal('-Inf')) Decimal('-Infinity') R(R&(RR((s/usr/lib64/python2.6/decimal.pyR&<scCs|id|S(sLRounds to an integer. When the operand has a negative exponent, the result is the same as using the quantize() operation using the given operand as the left-hand-operand, 1E+0 as the right-hand-operand, and the precision of the operand as the precision setting, except that no flags will be set. The rounding mode is taken from the context. >>> ExtendedContext.to_integral_value(Decimal('2.1')) Decimal('2') >>> ExtendedContext.to_integral_value(Decimal('100')) Decimal('100') >>> ExtendedContext.to_integral_value(Decimal('100.0')) Decimal('100') >>> ExtendedContext.to_integral_value(Decimal('101.5')) Decimal('102') >>> ExtendedContext.to_integral_value(Decimal('-101.5')) Decimal('-102') >>> ExtendedContext.to_integral_value(Decimal('10E+5')) Decimal('1.0E+6') >>> ExtendedContext.to_integral_value(Decimal('7.89E+77')) Decimal('7.89E+77') >>> ExtendedContext.to_integral_value(Decimal('-Inf')) Decimal('-Infinity') R(R(RR((s/usr/lib64/python2.6/decimal.pyRYsN(QR R!R"R@RRR;R'R:RtRUR^RRRRRR(RR\RRR0RR1R,R9RRRR:RRRRJRR=R>R!RR?RuR@RtRARBRIRLRMRXRZR[RYRR\RR]RRR`RaRcRReRRR RfRRRkR"RoRR+RRRR&RR(((s/usr/lib64/python2.6/decimal.pyRUs "                                          /  E 3           R]cBs)eZdZddZdZeZRS(R-RGRJcCs|djod|_d|_d|_nft|to.|i|_t|i|_|i|_n(|d|_|d|_|d|_dS(Niii( R@R-RGRJRQRR%R&RC(RRg((s/usr/lib64/python2.6/decimal.pyR~s       cCsd|i|i|ifS(Ns (%r, %r, %r)(R-RGRJ(R((s/usr/lib64/python2.6/decimal.pyRs(ssignsintsexpN(R R!RR@RRR(((s/usr/lib64/python2.6/decimal.pyR]xs  icCs|i|ijo|}|}n |}|}tt|i}tt|i}|itd||d}||id|jod|_||_n|id|i|i9_|i|_||fS(scNormalizes op1, op2 to have the same exp and length of coefficient. Done during addition. iiii (RJRXRWRGR(RRR3ttmpRpttmp_lent other_lenRJ((s/usr/lib64/python2.6/decimal.pyRs    iREiRit2t3t4t5t6t7t8R1RRWR)RnRRcCsA|djotdnd|}dt|||dS(s[Number of bits in binary representation of the positive integer n, or 0 if n == 0. is-The argument to _nbits should be nonnegative.s%xi(R`RX(R#t correctionthex_n((s/usr/lib64/python2.6/decimal.pyRs  cCsc|djp |djotdnd}x,||jo||| |d?}}q3W|S(sClosest integer to the square root of the positive integer n. a is an initial approximation to the square root. Any positive integer will do for a, but the closer a is to the square root of n the faster convergence will be. is3Both arguments to _sqrt_nearest should be positive.i(R`(R#RRW((s/usr/lib64/python2.6/decimal.pyt _sqrt_nearests cCs7d|>||?}}|d||d@|d@|jS(sGiven an integer x and a nonnegative integer shift, return closest integer to x / 2**shift; use round-to-even in case of a tie. lii((RRRWR((s/usr/lib64/python2.6/decimal.pyt_rshift_nearestscCs/t||\}}|d||d@|jS(saClosest integer to a/b, a and b positive integers; rounds to even in the case of a tie. ii(R(RRWRR((s/usr/lib64/python2.6/decimal.pyt _div_nearestsic CsH||}d}x||jo!tt|||>|jp(||jodt|||?|joItt||d>|t||t|||}|d7}qWtdtt|d| }t||}t||}x>t|dddD]&}t||t|||}q Wt|||S(sInteger approximation to M*log(x/M), with absolute error boundable in terms only of x/M. Given positive integers x and M, return an integer approximation to M * log(x/M). For L = 8 and 0.1 <= x/M <= 10 the difference between the approximation and the exact result is at most 22. For L = 8 and 1.0 <= x/M <= 10.0 the difference is at most 15. In both cases these are upper bounds on the error; it will usually be much smaller.iiiii( R[R\RRRRGRXRWR( RtMtLRtRtTtyshifttwtk((s/usr/lib64/python2.6/decimal.pyt_ilogs .('%$c Cs|d7}tt|}||||dj}|djod|}|||}|djo|d|9}nt|d| }t||}t|}t|||}||} nd}t|d| } t| |dS(sGiven integers c, e and p with c > 0, p >= 0, compute an integer approximation to 10**p * log10(c*10**e), with an absolute error of at most 1. Assumes that c*10**e is not exactly 1.iiii id(RXRWRRt _log10_digits( R)RRR*RRRtlog_dtlog_10t log_tenpower((s/usr/lib64/python2.6/decimal.pyRKs      c Cs|d7}tt|}||||dj}|djoX|||}|djo|d|9}nt|d| }t|d|}nd}|o\ttt|d}||djo%t|t||d|}qd}nd}t||dS(sGiven integers c, e and p with c > 0, compute an integer approximation to 10**p * log(c*10**e), with an absolute error of at most 1. Assumes that c*10**e is not exactly 1.iiii id(RXRWRRR\R( R)RRR*RRRRt f_log_ten((s/usr/lib64/python2.6/decimal.pyRH5s"   % t _Log10MemoizecBs eZdZdZdZRS(sClass to compute, store, and allow retrieval of, digits of the constant log(10) = 2.302585.... This constant is needed by Decimal.ln, Decimal.log10, Decimal.exp and Decimal.__pow__.cCs d|_dS(Nt/23025850929940456840179914546843642076011014886(Rk(R((s/usr/lib64/python2.6/decimal.pyRescCs|djotdn|t|ijod}xeto]d||d}tttd||d}|| d|joPn|d7}q<W|idd |_nt|i|d  S( stGiven an integer p >= 0, return floor(10**p)*log(10). For example, self.getdigits(3) returns 2302. isp should be nonnegativeii iidREii( R`RXRkR'RWRRRRG(RRRRRk((s/usr/lib64/python2.6/decimal.pyt getdigitshs "(R R!R"RR(((s/usr/lib64/python2.6/decimal.pyRas c Cstt||>|}tdtt|d| }t||}t||>}x9t|dddD]!}t|||||}quWxIt|dddD]1}t||d>}t||||}qW||S(sGiven integers x and M, M > 0, such that x/M is small in absolute value, compute an integer approximation to M*exp(x/M). For 0 <= x/M <= 2.4, the absolute error in the result is bounded by 60 (and is usually much smaller).iiiiii(RR[RGRXRWRR( RRRRRRtMshiftRR((s/usr/lib64/python2.6/decimal.pyt_iexps%c Cs|d7}td|tt|d}||}||}|djo|d|}n|d| }t|t|\}}t|d|}tt|d|d||dfS(sCompute an approximation to exp(c*10**e), with p decimal places of precision. Returns integers d, f such that: 10**(p-1) <= d <= 10**p, and (d-1)*10**f < exp(c*10**e) < (d+1)*10**f In other words, d*10**f is an approximation to exp(c*10**e) with p digits of precision, and with an error in d of at most 1. This is almost, but not quite, the same as the error being < 1ulp: when d = 10**(p-1) the error could be up to 10 ulp.iiii ii(RRXRWRRRR( R)RRRRRtcshifttquotR((s/usr/lib64/python2.6/decimal.pyR;s #   c Cs0ttt||}t||||d}||}|djo||d|}nt||d| }|djodtt||dj|djjo!d|ddd|} } q&d|d| } } n;t||d |d\} } t| d} | d7} | | fS(s5Given integers xc, xe, yc and ye representing Decimals x = xc*10**xe and y = yc*10**ye, compute x**y. Returns a pair of integers (c, e) such that: 10**(p-1) <= c <= 10**p, and (c-1)*10**e < x**y < (c+1)*10**e in other words, c*10**e is an approximation to x**y with p digits of precision, and with an error in c of at most 1. (This is almost, but not quite, the same as the error being < 1ulp: when c == 10**(p-1) we can only guarantee error < 10ulp.) We assume that: x is positive and not equal to 1, and y is nonzero. iii (RXRWR\RHRR;( RRRRRRWtlxcRtpcRRJ((s/usr/lib64/python2.6/decimal.pyR s   )!! idiFi5i(iiii icCsC|djotdnt|}dt|||dS(s@Compute a lower bound for 100*log10(c) for a positive integer c.is0The argument to _log10_lb should be nonnegative.id(R`RWRX(R)Rtstr_c((s/usr/lib64/python2.6/decimal.pyRs  cCsUt|to|St|ttfo t|S|otd|ntS(s]Convert other to Decimal. Verifies that it's ok to use in an implicit construction. sUnable to convert %s to Decimal(RQRRGR[ReR(RpR((s/usr/lib64/python2.6/decimal.pyRs R3iR2RRR4iɚ;Ri6eRi s # A numeric string consists of: # \s* (?P[-+])? # an optional sign, followed by either... ( (?=\d|\.\d) # ...a number (with at least one digit) (?P\d*) # having a (possibly empty) integer part (\.(?P\d*))? # followed by an optional fractional part (E(?P[-+]?\d+))? # followed by an optional exponent, or... | Inf(inity)? # ...an infinity, or... | (?Ps)? # ...an (optionally signaling) NaN # NaN (?P\d*) # with (possibly empty) diagnostic info. ) # \s* \Z s0*$s50*$s\A (?: (?P.)? (?P[<>=^]) )? (?P[-+ ])? (?P0)? (?P(?!0)\d+)? (?:\.(?P0|(?!0)\d+))? (?P[eEfFgG%])? \Z cCsti|}|djotd|n|i}|d}|d}|iddj ol|dj o!|djotd|n|dj o!|djotd|nd}d}n|pd |d<|pd |d<|d djod |d ', '=' or '^' sign: either '+', '-' or ' ' minimumwidth: nonnegative integer giving minimum width precision: nonnegative integer giving precision, or None type: one of the characters 'eEfFgG%', or None unicode: either True or False (always True for Python 3.x) sInvalid format specifier: tfilltaligntzeropadREs7Fill character conflicts with '0' in format specifier: t=s2Alignment conflicts with '0' in format specifier: t tRiR(RXRR( tbodyt spec_dictR-RRtpaddingRRthalf((s/usr/lib64/python2.6/decimal.pyR~s. $     !     tInfs-InfRt__main__(nR"t__all__R:t_copytnumberst_numberst collectionsRt _namedtupleRt ImportErrorRRRRRRRRtArithmeticErrorRRRR+tZeroDivisionErrorRR.R/R R0R R R R RRR<R7ROR5R8R>thasattrR=R9RRR@RRRYR$tNumbertregisterRVt__dict__tkeystnamet startswithtrounding_functionstuppert globalnametglobalstvalRRARR]RRRRRRRKRHRRRRR;R RRRRRtretcompiletVERBOSEt IGNORECASEtUNICODERRSRRRR}R~RGRFR)R3R R2R,R tdoctestttestmodR6(((s/usr/lib64/python2.6/decimal.pytts*             &            *7 $  ( #%    0 " ,#  % $ *#%            : 2