Tryag File Manager
Home
-
Turbo Force
Current Path :
/
usr
/
lib
/
python2.4
/
Upload File :
New :
File
Dir
//usr/lib/python2.4/fpformat.pyc
mò ‚=5Dc @ s d Z d k Z d d d g Z e i d ƒ Z y d e f d „ ƒ YZ Wn e j o d Z n Xd „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d S( s8 General floating point formatting functions. Functions: fix(x, digits_behind) sci(x, digits_behind) Each takes a number or a string and a number of digits as arguments. Parameters: x: number to be formatted; or a string resembling a number digits_behind: number of digits behind the decimal point Nt fixt scit NotANumbers- ^([-+]?)0*(\d*)((?:\.\d*)?)(([eE][-+]?\d+)?)$c B s t Z RS( N( t __name__t __module__( ( ( t /usr/lib/python2.4/fpformat.pyR s s fpformat.NotANumberc C sª t i | ƒ } | d j o t | ‚ n | i d d d d ƒ \ } } } } | d j o d } n | o | d } n | o t | d ƒ } n d } | | | | f S( sÅ Return (sign, intpart, fraction, expo) or raise an exception: sign is '+' or '-' intpart is 0 or more digits beginning with a nonzero fraction is 0 or more digits expo is an integeri i i i t +t i N( t decodert matcht st rest NoneR t groupt signt intpartt fractiont exppartt intt expo( R R R R R R R ( ( R t extract s $ c C s¾ | d j oL t | ƒ } | | | | | } } | | j o | d | | } q´ n\ | d j oN t | ƒ } | | | | | } } | | j o d | | | } q´ n | | f S( s5 Remove the exponent by changing intpart and fraction.i t 0N( R t lenR t fR t i( R R R R R ( ( R t unexpo/ s c C sp t | ƒ } | | j o | | d | | f Sn t | ƒ } | | d j o d | d f Sn | | } | | | } | d j o® | | d } xL | d j o$ | | d j o Pn | d } q™ Wd | } | d } d } | | t t | | ƒ d ƒ d t | ƒ | d } | | | | } } n | d j o | | | f Sn | | d | d f Sd S( s* Round or extend the fraction to size digs.R i R t 5i t 9N( R R R t digsR R t totalt nextdigitt nt chrt ord( R R R R R R R R ( ( R t roundfrac= s0 8 c C sý t | ƒ t d ƒ j o t | ƒ } n y t | ƒ \ } } } } Wn t j o | Sn Xt | | | ƒ \ } } t | | | ƒ \ } } x' | o | d d j o | d } q’ W| d j o d } n | d j o | | d | Sn | | Sd S( s‡ Format x as [-]ddd.ddd with 'digs' digits after the point and at least one digit before. If digs <= 0, the point is suppressed.R i R i t .N( t typet xt reprR R R R R R R R"