This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How can I convert from unsigned int to double so that I can use the sqrt function?

Hi guys,

this may seem like a newbie type of question but i'm really stumped on this one. I want to use the sqrt() function from math.h on two variables which are unsigned int.

if i do:

unsigned int Id, Iq;
double temp;
Id = ///some function call
temp = (double)Id;

and assuming Id contains say 0x2700, after executing the 3rd line, temp = 0, not 9984 as it should. Does anyone know how I can convert from unsinged int to double besides the way I've tried.

thanks a lot.

Nick

0