Miriam, Which version of GCC are you using? 64 bit (long int) operations are broken in GCC 3.x. If you are using a newer version of GCC you should try to cast all variables to long int.
Nico Coesel At 13:07 10-5-2011, Miriam Dali wrote: >Thank you for your answer , I'm really sorry my question was not clear :( >I wrote a simple code in C, but when I port it >to mspgcc it doesn't give me the right value. This is a part of my code: >unsigned short int xk=3588, yk=47541, yk1, sig=10, de=1; >unsigned long int xk1; >xk1=( xk+(sig*(yk-xk)*de)); >yk1=xk1 % 65535; > >the result that I expect is xk1=443118 and >yk1=49908, but in mspgcc it gives me xk1=yk1=49902 >I don't know where is the fault may be in the type choice? >thanks >--- En date de : Mar 3.5.11, M. Andree ><mand...@mail.uni-paderborn.de> a écrit : > >De: M. Andree <mand...@mail.uni-paderborn.de> >Objet: Re: [Mspgcc-users] modulo >À: mspgcc-users@lists.sourceforge.net >Date: Mardi 3 mai 2011, 1h11 > >Am 03.05.2011 02:55, schrieb Miriam Dali: > > hi, > > > > I want to ask questions about modulo (%), why it doesn't work, if I > > want to have numbers between 0 and 65535 using the modulo doesn't work > > ,the number that I get is truncated, I > thought to use fmod but it seems consuming energy > > any ideas? > > thanks a lot > >Voir http://www.chiark.greenend.org.uk/~sgtatham/bugs.html s.v.p. >It even has a French translation. Merci. > >-- >M. Andree > >------------------------------------------------------------------------------ >WhatsUp Gold - Download Free Network Management Software >The most intuitive, comprehensive, and cost-effective network >management toolset available today. Delivers lowest initial >acquisition cost and overall TCO of any competing solution. >http://p.sf.net/sfu/whatsupgold-sd >_______________________________________________ >Mspgcc-users mailing list >Mspgcc-users@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/mspgcc-users > >------------------------------------------------------------------------------ >Achieve unprecedented app performance and reliability >What every C/C++ and Fortran developer should know. >Learn how Intel has extended the reach of its next-generation tools >to help boost performance applications - inlcuding clusters. >http://p.sf.net/sfu/intel-dev2devmay >_______________________________________________ >Mspgcc-users mailing list >Mspgcc-users@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/mspgcc-users o---------------------------------------------------------------o | N C T Developments | |Innovative embedded solutions | o---------------------------------------------------------------o ------------------------------------------------------------------------------ Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users