I have just been through this equation mess, so here are some
tips.  Feel free to email me directly at [EMAIL PROTECTED]
or to group. 

1. use the floating point manager
#include <NewFloatMgr.h>


2. If you need some math functions, 
Install Mathlib.prc on your emulator or device
then include the mathlib header file
#include "MathLib.h" 
and add mathlib.c to your project

3. Converting floating point results to strings
is a MOTHER, so I ended up faking it by stuffing
the floating point number into an integer
        
iResult = (int) (fResult*100); // my result is always between 0 and 1

then I used StrPrintF to create the string

StrPrintF (s, "%d %% (%d - %d)", wSurvival, 
                        (wSurvival <= 10)?0:wSurvival - 10,
                        (wSurvival >= 90)?100:wSurvival + 10);


There is a simple conversion routine on the developer faq
at www.palm.com

4. To get your floating point result in the right format,
you'll probably have to parse a string which contains the
number in exponential notation, then reconstruct it in 
your favorite format.  

Hope this helps.

Paul Fearn

-----Original Message-----
From: Abraham Smith [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 25, 1999 3:26 PM
To: [EMAIL PROTECTED]
Subject: doing math on the palm


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.  I am also 
trying to figure out how to display the results of this equation.  I 
would appreciate any advice on this issue.  
Please feel free to email me directly, as well as post to the group, any 
response.  My email is [EMAIL PROTECTED]

Thanks in advance,
Avi I. Smith

Get Your Private, Free Email at http://www.hotmail.com


Reply via email to