Just looking at this, I don't really see any problem. Since pixelSizeX is a
float, it should be doing a float division, so the fact that extentX is an
Int16 should not be a problem. It probably wouldn't hurt to cast extentX to
a float though. Incidently, since eastMin, eastMax, and extentX are all
known constants, why not set pixelSizeX to a contant value (2.155197)? No
need to perform the math each time the function is called.
In your original post, you said that the output of the function was always
zero. This could only happen if the sum of eastMin and (pixelSizeX * ptX) is
zero. Have you verified each of these values? Using the debugger to step
through the code would be my first step in solving this.
Mike Walters
Rose Software
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Sara
Revell
Sent: Sunday, July 29, 2001 8:28 AM
To: Palm Developer Forum
Subject: Re: Multiplying Ints and Floats
--- In [EMAIL PROTECTED], "Eric W. Sirko" <[EMAIL PROTECTED]> wrote:
> Sara, it's not clear from your post which variables are integers and which
> are floats. Thus I can't see what the problem is.
Sorry, I didn't want to fill the newsgroup with lots of code, and left that
out accidentely.
Here is the full function (it's short!)
static float PixelToEasting(Int16 ptX){
float eastMin, eastMax, easting;
float pixelSizeX;
Int32 extentX;
eastMin = 325000.61; //topleft
eastMax = 326530.80; //bottom right
extentX = 710;
pixelSizeX = (eastMax - eastMin) / extentX;
easting = eastMin + (pixelSizeX * ptX);
return easting;
}
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/