Abraham Smith wrote:
>
> I am in need of advice. I am writing a palm program that has to take
> numbers from several fields and run an equation with them. The equation
> could produce a positive or negative number, with up to 3 decimal
> places. I am trying to figure out what data types to store the numbers
> from the fields in, as well as the result of the equation. <snip>
Abraham,
One technique would be to use fixed point math. That is multiply the
input values by a factor, do the math, and then divide by the same
factor prior to display. If you need 3 decimal places, the factor would
be 10^3 or 1000.
The only difficult part here is converting the character string from the
field into an integer (or long). One approach would be to grab the
digits leading up to the decimal point, multiply by 1000, and then add
the three digits following the decimal point. You will probably want to
use StrAToI to convert the string to an integer, StrIToA to convert
back, and StrPrintF to format the string for display.
Paul . . .
--
___________________________________________________________________
dpw Designs http://www.pe.net/firm/dpw-designs
mailto:[EMAIL PROTECTED]