Changeset 3699587 in sasmodels


Ignore:
Timestamp:
Feb 10, 2015 11:18:32 AM (10 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
660cdd6
Parents:
34756fd
Message:

document double→float conversion internals

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/gen.py

    r994d77f r3699587  
    422422    Convert code from double precision to single precision. 
    423423    """ 
    424     source = re.sub(r'(^|[^a-zA-Z0-9_])double($|[^a-zA-Z0-9_])', 
     424    # Convert double keyword to float.  Accept an 'n' parameter for vector 
     425    # values, where n is 2, 4, 8 or 16. Assume complex numbers are represented 
     426    # as cdouble which is typedef'd to double2. 
     427    source = re.sub(r'(^|[^a-zA-Z0-9_]c?)double(([248]|16)?($|[^a-zA-Z0-9_]))', 
    425428                    r'\1float\2', source) 
     429    # Convert floating point constants to single by adding 'f' to the end. 
     430    # OS/X driver complains if you don't do this. 
    426431    source = re.sub(r'[^a-zA-Z_](\d*[.]\d+|\d+[.]\d*)([eE][+-]?\d+)?', 
    427432                    r'\g<0>f', source) 
Note: See TracChangeset for help on using the changeset viewer.