Changeset 1447 for trunk/GSASIIpy3.py


Ignore:
Timestamp:
Jul 30, 2014 1:14:01 PM (7 years ago)
Author:
toby
Message:

address strange EPD7.3.2 bug with : in float formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpy3.py

    r1410 r1447  
    1111import GSASIIpath
    1212GSASIIpath.SetVersionNumber("$Revision$")
    13 # de
     13# declare symbol (pi) and functions allowed in expressions
    1414sind = sin = s = lambda x: np.sin(x*np.pi/180.)
    1515cosd = cos = c = lambda x: np.cos(x*np.pi/180.)
     
    7777    else:
    7878        digits = list(maxdigits)
    79     string = ("{:."+str(digits[1])+"f}").format(val).strip() # will standard .f formatting work?
     79    fmt="{:."+str(digits[1])+"f}"
     80    string = fmt.format(float(val)).strip() # will standard .f formatting work?
    8081    if len(string) <= digits[0]:
     82        if ':' in string: # deal with weird bug where a colon pops up in a number when formatting (EPD 7.3.2!)
     83            string = str(val)
    8184        if digits[1] > 0: # strip off extra zeros on right side
    8285            string = string.rstrip('0')
Note: See TracChangeset for help on using the changeset viewer.