The only thing I can say is that sometiemes the printf function do only support 
16bit unsigned integers. Larger values than 65535 will be truncated to the 
lowest 16bit (e.g. avr)

Tobias

----- Ursprüngliche Nachricht -----
Von: wasif masood <rwmas...@gmail.com>
Datum: Montag, Oktober 4, 2010 3:33 pm
Betreff: [Tinyos-help] No Subject
An: tinyos forum <tinyos-help@millennium.berkeley.edu>

> I dont whether its a stupid question or not, but I am stucked in a very 
> simple equation,

> uint32_t latest
> uint32_t packetsLost
> uint32_t packetsSend

> latest =0;
> packetsLost = 0 ;
> packetsSend = 0;
  
> printf("latest:%u\n",latest);printfflush();

> latest = 100*packetsLost/packetsSend;

> printf("latest:%u\n",latest);printfflush();

> out is :

> latest : 0
> latest : 65536

  
> can any one please tell me what is wrong why after the division its giving 
> 65535 where as if I simply do :

> latest = 100*0 / 0

> output is 0
> Wasif Masood

 > _______________________________________________
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-
> bin/mailman/listinfo/tinyos-help

-- 
Dipl.-Ing. Tobias Rossbach
Wissenschaftlicher Mitarbeiter

IMMS Institut für Mikroelektronik- und Mechatronik-Systeme gGmbH
Ehrenbergstrasse 27
D - 98693 Ilmenau

Tel.  : +49.3677.6955.48
Fax   : +49.3677.6955.15
E-Mail: tobias.rossb...@imms.de
WWW   : http://www.imms.de

Geschäftsführer: Prof. Dr. Ralf Sommer -  Dipl.-Ing. Hans-Joachim Kelm
Aufsichtsratsvorsitzender: Dr. Jörg Prinzhausen
Sitz: Ilmenau - Rechtsform: Gesellschaft mit beschränkter Haftung
Registergericht: Amtsgericht Jena HRB 303807

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. 
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten 
haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. 
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht 
gestattet.
This e-mail contains confidential and/or privileged information. If you are not 
the intended recipient (or have received this e-mail in error) please notify 
the sender immediately and destroy this e-mail. Any unauthorised copying, 
disclosure or distribution of the material in this e-mail is strictly 
forbidden. 



_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to