(Part 2 of the post above)
A second issue that I encountered (and was able to work around) while developing the module is the following:
When I moved over to work the voltage module, a need to deal with floating point numbers emerged. My first idea was to use the standard C functions. However, it turns out that all C functions dealing with floating point numbers are unsupported when developing non-applications in Think C. Bummer.
Okay, surely then, there must be some useful toolbox function to do this (specifically, convert floating point numbers to text strings). When looking into Apple's documentation, I found the following:
Needless to say, I developed my own function for the conversion.
I can see the that this amount of flexibility could be useful when developing more advanced applications, but when just performing simple conversions, I would have imagined that the system functions would just use whatever numerical format was specified in the Numbers control panel.
Is this convoluted method really the only way Apple provided for converting simple floating point numbers to strings?
A second issue that I encountered (and was able to work around) while developing the module is the following:
When I moved over to work the voltage module, a need to deal with floating point numbers emerged. My first idea was to use the standard C functions. However, it turns out that all C functions dealing with floating point numbers are unsupported when developing non-applications in Think C. Bummer.
Okay, surely then, there must be some useful toolbox function to do this (specifically, convert floating point numbers to text strings). When looking into Apple's documentation, I found the following:
If you are working with floating-point numbers, or if you want to accommodate the possible differences in output formats for numbers in different countries and regions of the world, you need to work with number format specification strings. […] To use number format specification strings and convert numbers, you need to follow these steps:
1. You first define the format of numbers with a number format specification string. An example of such a string is ###,###.##;-###,###.##;0. This string specifies three number formats: for positive number values, for negative number values, and for zero values. The section "Using Number Format Specification Strings," which begins on page 5-39, describes these definitions in detail.
2. You must also define the syntactic components of numeric string formats using a number parts table. This table is part of the tokens ('itl4') resource for each script system. It includes definitions of which characters are used in numeric strings for displaying the percent sign, the minus sign, the decimal separator, the less than or equal sign, and other symbols. The number parts table is described with the tokens resource in the appendix "International Resources" in this book.
3. You then use Text Utilities routines to convert the number format specification string into an internal representation that is stored in a NumFormatStringRec record. This is a private data type that is used by the number conversion routines. You convert a number format specification string into a NumFormatStringRec record with the StringToFormatRec function, and you perform the opposite conversion with the FormatRecToString function. Both of these functions are described in the section "Converting Number Format Specification Strings Into Internal Numeric Representations," which begins on page 5-43.
4. Once you have a NumFormatStringRec record that defines the format of numbers for a certain country or region, you can convert floating-point numbers into numeric strings and numeric strings into floating-point numbers. The StringToExtended and ExtendedToString functions perform these conversions; these are described in the section "Using Number Format Specification Strings," which begins on page 5-39.
Needless to say, I developed my own function for the conversion.
I can see the that this amount of flexibility could be useful when developing more advanced applications, but when just performing simple conversions, I would have imagined that the system functions would just use whatever numerical format was specified in the Numbers control panel.
Is this convoluted method really the only way Apple provided for converting simple floating point numbers to strings?

