The Math Library: 3.2 Float Formats: User-defined Formats

Up: GEOS SDK TechDocs | Up | Prev: 3.1 System-defined Formats | Next: 4 Direct FP Operations

Users may also design their own float formatting options. These user-defined formats are stored in FormatEntry structures. The array of these user-defined formats is kept separate from the system-defined formats. (user-defined formats are stored within their own VM block).

User-defined FormatIdType enums do not have the high bit (8000h) set in order to distinguish them from system-defined FormatIdType enums.

Code Display D-8 User-defined Formats

/*
 * User-defined formats are stored in a VM block that is created and maintained by 
 * the float controller code. As each new format is added, space is made for a 
 * FormatEntry structure. As formats are deleted, their entry's FE_used field is 
 * set to zero to indicate that the entry is free for new formats to overwrite.
 */
typedef struct {
	/*
	 * Each FormatEntry contains a corresponding FormatParams structure.
	 */
	FormatParams 		FE_params;
	/*
	 * FE_listEntryNumber is the zero-based position of the format counting 
	 * both previous user-defined formats and system-defined formats. For 
	 * example, if there are 10 system-defined formats, the first user-defined
	 * format will have a FE_listEntryNumber of 10 (because positions are 
	 * zero-based).
	 */
	word		FE_listEntryNumber;
	/*
	 * FE_used, if non-zero, indicates that this entry within the user-defined 
	 * list is currently in use. If FE_used is zero, then this entry position 
	 * may be used to add a new user-defined entry without increasing the size
	 * of the VM block.
	 */
	byte		FE_used;
	/*
	 * FE_sig is an error-checking field used internally.
	 */
	word		FE_sig;
} FormatEntry;

Up: GEOS SDK TechDocs | Up | Prev: 3.1 System-defined Formats | Next: 4 Direct FP Operations