... and don't forget to declare :

 Int32 p;

instead of

Int16 p;

since Int16 is a 16 bits integer, so max integer is 65536 (unsigned
integer). That's why 200 000 in Int16 gives 3392 ( 200 000 % 65536 )


Cordialement,
Agus Silas
BST Technologies
T. (+33) 5 57 80 16 03
F. (+33) 5 57 77 29 97
http://www.bst-technologies.com

********************************************
********************************************

-----Message d'origine-----
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]De la part de Brad
Figler
Envoy� : jeudi 10 octobre 2002 10:12
� : Palm Developer Forum
Objet : Re: calculation goes wrong ...


Once you fix the Int16 issue, I think (I am pretty sure) you will still need
to change your %d formatter to %ld to get the complete 32 bit value to
format correctly.  I ran in to this problem when using the %x formatter
without the 'l' modifier.

Brad

"Sebastian from Berlin/Germany" <[EMAIL PROTECTED]> wrote in message
news:97979@palm-dev-forum...
>
>
> Hey,
>
> if i run the following code:
>
> Int16 count[6];
> char counterlabel[40];
> Int16 p, all,allcards;
>
> count[1]=2000;
> p=(100*count[1]);
> StrPrintF (counterlabel,"Box 1 - %d cards (%d %%) - %d",
> count[1],p,count[1]);
>
> i get a counterlabel = "Box 1 - 2000 cards (3392 %) - 2000"
>
> Why the hell 3392??? I thought about 200000 ...
>
>
> Thank you
> Greets
> Sebastian
>
>
>
>
>
>
>
>



--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to