32 bit Overflow incorrectly handled (?)

Discuss PocketC for Palm OS (including Desktop Edition)

Postby pld on Mon Feb 05, 2001 7:49 pm

32 bit overflow seems to be incorrectly handled by PocketC for certain calculations.

For example:

0x7fffffff * 0xfffffffe ==> 0xfffffffc (-4)

The correct overflow scenario ought to be:

0x7fffffff * 0xfffffffe ==> 0x00000002 (2)
This can also be verified the hard way by a pen and a piece of paper. Other 32 bit signed calculators does this correctly,
for example WIN95 calcualtor.
Posts: 19
Joined: Mon Dec 18, 2000 5:23 pm
Location: Norway

Postby awschwab on Wed Feb 14, 2001 2:24 pm

Another type of overflow can be confusing. If you include too much precision in a floating point constant (eg. fCosF=cos(6.283185307/iN);) it compiles without error messages on both PDE and PocketC on the Palm device. Code compiled on PDE runs fine on POSE and the device, which makes it harder to find the error. Compilation on the Palm device gives output that does not run properly. Solution: If you want to compile on the device, don't check whether you have included too many digits by compiling with PDE.
Posts: 270
Joined: Tue Feb 06, 2001 2:33 pm
Location: USA

Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 2 guests