Home | Trees | Indices | Help |
---|
|
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
This is q think wrapper around python's frexp that returns a mantissa and exponent in a form that is a little more convenient for the the fileio module. Namely the exponent offset form is preferable since there's now only one sign to worry about. This greatly simplifies file i/o. The mantissa is converted to an integer (* 10**15 to minimize precision loss and fits into 52 bits) and the exponent is shifted by 1023 to guarantee it is an unsigned integer and fits into 11 bits.
|
This function performs the inverse of _frexp. Given a mantissa and exponent, it returns the float representation.
|
This function takes a bit_string (i.e. '10010011') and returns a string of characters ('' in this example) that can be fed to python's file write method. |
This function takes a character string (i.e. '') and returns a string of bits ('10010011' in this example) that can be converted to the correct type. |
This is expecting an integer. The purpose of this function is to return the bit_string representation of the mantissa. The length of the string is 52 characters long and is meant to be combined with the 11 bit exponent and 1 sign bit to form a 64 bit string representation of a double precision float. |
This is expecting an integer. The purpose of this function is to return the bit_string representation of the exponent. The length of the string is 11 characters long and is meant to be combined with the 52 bit exponent and 1 sign bit to form a 64 bit string representation of a double precision float. |
This function translates a float to its 8 byte character string repesentation so that python's file write method can write it. The 64 bit representation is a follows:
So read as a string the SIGN is in the 0th position, the EXPONENT is 1-11, and the MANTISSA is 12-52. m / 10.**15, e - 1023 f = (-1)**SIGN * (MANTISSA/10**15) * 2**(EXPONENT - 1023 ) |
This function translates an 8 byte character string repesentation to a float. See the coreresponding _frexp function for the byte layout and interpretation. |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Feb 14 13:16:42 2011 | http://epydoc.sourceforge.net |