Hi, In order to assign a float value to a variable, you basically have to CAST everything that is not float in your equation. For example:
float a; a = (8-3)/(9-1); you'll get 1 (rounded) But float a; a = (float)(8-3)/(float)(9-1); you'll get 0.625 One more thing is the accuracy of the float. You'll get a maximum of 8 digits in total, before and after the "point". For example, if you have this value 123.45678912 you'll get 123.45679 (total of 9 digits). Good luck, I hope it works for you. Hussein Adeel Akhtar wrote: > Hi All > can anybody tell me how to handle float numbers in nesc language? > > -- > > > Thanks & Best Regards > > Adeel Akhtar > ------------------------------------------------------------------------ > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
