Int32 and UInt32 on Palm hold the same as a signed and unsigned 32 bit
integer on every other platform.

signed 32 bit integer = -(2^31)..(2^31-1) = (2-2147483648..2147483647
unsigned 32 bit integer = 0..(2^32-1) = 0..4294967295

You probably did something like the following:

Int32 result = 370 * 370;   // you expect 136900, but get 5828

The size of the left hand side of your assignment is not the problem. We
know that 370 * 370 = 136900. However, the compiler computed the right hand
side as an int, which is probably set to 2 byte (16 bits), not 4 byte (32
bits). The 16 bit int result is missing the top 2 bits of the result you
expect. This truncated result is then placed in the 32 bit integer 'result'.

Use this, instead:

Int32 x = 370L * 370L;   // right hand side is computed as a 32 bit int

You asked about larger integers. Most compilers these days understand at
least 'long long' or QWord, which is an 8 byte (64 bit) integer. This is not
a native size on Palm, but is supported in code.

On 3/1/07, Anoop <[EMAIL PROTECTED]> wrote:
>
> Hi,
>     Can anyone tell us how much value Int32 and UInt32 can hold in palm
> . Is there any data type which can hold bigger than this.
>
> for eg we were not able to hold the square of the no: 370 in UInt32 ,
> long , Int32.
> Waiting for ur speedy reply.
>
> thanx
> anoop
>
>
> --
> For information on using the ACCESS Developer Forums, or to unsubscribe,
> please see http://www.access-company.com/developers/forums/
>



-- 
[Jeff Loucks]

-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to