Changeset 1255 for trunk/GSASIIpy3.py


Ignore:
Timestamp:
Mar 19, 2014 2:55:17 PM (8 years ago)
Author:
toby
Message:

stab at fixing Bob's Linux bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpy3.py

    r1236 r1255  
    145145    else: # larger numbers, remove decimal places
    146146        decimals = sigfigs - 1 - int(np.log10(abs(val)))
    147         fmt = "{" + (":{:d}.{:d}f".format(maxdigits,decimals))+"}"
    148         if decimals == 0: fmt += "." # force a decimal place
     147        if decimals <= 0:
     148            fmt = "{" + (":{:d}.0f".format(maxdigits))+"}."
     149        else:
     150            fmt = "{" + (":{:d}.{:d}f".format(maxdigits,decimals))+"}"
    149151    try:
    150152        return fmt.format(float(val)).strip()
     
    160162    for i in (1,10,100,1000,10000,100000,1000000,10000000,100000000):
    161163        print FormatSigFigs(1.23456789e9/i),1.23456789e9/i
     164
     165    print FormatSigFigs(200,10,3)
Note: See TracChangeset for help on using the changeset viewer.