NS BASIC Tech Note                                        April 3, 1997

41 How to format numbers
-----------------------------------------------------------------
FormattedNumberStr(number, formatString) 

Returns a formatted string representation of a real number. 

    number          A number. 
    formatString	A string specifying how the number should be formatted. 
	
The formatString specifies how the number should be formatted; that is, 
whether to use decimal or exponential notation and how many places to 
include after the decimal point. It accepts the following format 
specifiers: 

    %f	Use decimal notation (such as "123,456.789000"). 
    %e	Use exponential notation (such as "1.234568e+05"). 
    %E	Use exponential notation (such as "1.234568E+05"). 
    
You can also specify a period followed by a number after the % symbol to 
indicate how many places to show following the decimal point.  ("%.3f" 
yields "123,456.789" for example.) 

Note: FormattedNumberStr uses the current values of 
GetLocale().numberFormat to get the separator and decimal characters and 
settings.  The example strings above are for the US English locale. 

Large numbers: FormattedNumberStr does not work properly for numbers 
larger than 1.0e24.  If the number is very large the function can cause 
the Newton device to hang. 

Small numbers or long numbers: If more than 15 characters of output would 
be generated, for example because you are using %f with large number or a 
large number of digits following the decimal, FormattedNumberStr has 
undefined results, and can cause the Newton device to hang. 

Rounding: FormattedNumberStr does not guarantee which direction it will 
round.  In the Newton 2.0 OS, it rounds half cases down rather than up or 
to an even digit.  If you need a precisely rounded number you should use 
the math functions Ceiling, Floor, NearbyInt, or Round with suitable math. 
Trailing decimals